From 969b079ae7848d26bc4f4d96c3bdef06b4db71a9 Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Tue, 2 Dec 2025 07:59:17 +0100 Subject: [PATCH 01/79] [Advanced Logbook] Started on dbtools --- application/controllers/Logbookadvanced.php | 15 +++ application/models/Logbookadvanced_model.php | 15 +++ .../views/logbookadvanced/dbtoolsdialog.php | 117 ++++++++++++++++++ application/views/logbookadvanced/index.php | 1 + assets/js/sections/logbookadvanced.js | 65 ++++++++++ 5 files changed, 213 insertions(+) create mode 100644 application/views/logbookadvanced/dbtoolsdialog.php diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php index 8b963fefa..301bf6139 100644 --- a/application/controllers/Logbookadvanced.php +++ b/application/controllers/Logbookadvanced.php @@ -884,4 +884,19 @@ class Logbookadvanced extends CI_Controller { public function callbookDialog() { $this->load->view('logbookadvanced/callbookdialog'); } + + public function dbtoolsDialog() { + $this->load->view('logbookadvanced/dbtoolsdialog'); + } + + public function checkDb() { + if(!clubaccess_check(9)) return; + + $type = $this->input->post('type', true); + + $this->load->model('logbookadvanced_model'); + $result = $this->logbookadvanced_model->runCheckDb($type); + header("Content-Type: application/json"); + print json_encode($result); + } } diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php index f283af058..924af2f26 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -1446,4 +1446,19 @@ class Logbookadvanced_model extends CI_Model { return $recordcount; } + + public function runCheckDb($type) { + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + $sql = "select count(*) as count from " . $this->config->item('table_name') . " + join station_profile on " . $this->config->item('table_name') . ".station_id = station_profile.station_id + where " . $this->config->item('table_name') . ".station_id in (" . implode(',', array_map('intval', $logbooks_locations_array)) . ") + and user_id = ? and coalesce(col_distance, '') = ''"; + + $bindings[] = [$this->session->userdata('user_id')]; + + $query = $this->db->query($sql, $bindings); + return $query->result(); + } } diff --git a/application/views/logbookadvanced/dbtoolsdialog.php b/application/views/logbookadvanced/dbtoolsdialog.php new file mode 100644 index 000000000..e1ae53af0 --- /dev/null +++ b/application/views/logbookadvanced/dbtoolsdialog.php @@ -0,0 +1,117 @@ +
= __("Update missing or incorrect CQ zone information") ?>
+= __("Update missing or incorrect ITU zone information") ?>
+= __("Update missing or incorrect continent information") ?>
+= __("Update missing or incorrect state/province information") ?>
+= __("Calculate and update distance information for QSOs") ?>
+= __("Identify QSOs that are missing DXCC information") ?>
+= __("Use Wavelog to determine DXCC for all QSOs. This will overwrite existing DXCC information.") ?>
+QSO to update found: ' + (response[0].count) + '
'; + + $('.result').html(resultHtml); + }, + error: function(xhr, status, error) { + $('#checkUpdateDistancesBtn').prop('disabled', false).text('= __("Check") ?>'); + $('#closeButton').prop('disabled', false); + + let errorMsg = '= __("Error checking distance information") ?>'; + if (xhr.responseJSON && xhr.responseJSON.message) { + errorMsg += ': ' + xhr.responseJSON.message; + } + + BootstrapDialog.alert({ + title: '= __("Error") ?>', + message: errorMsg, + type: BootstrapDialog.TYPE_DANGER + }); + } + }); + + + } From cdf942d3bddeb2b49b901cf90f6a52050041b67d Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Sun, 7 Dec 2025 14:18:20 +0100 Subject: [PATCH 02/79] Tweaked layout a bit and implemented checks for continent/dxcc/distance --- application/models/Logbookadvanced_model.php | 43 ++++++ .../views/logbookadvanced/dbtoolsdialog.php | 58 ++++---- assets/js/sections/logbookadvanced.js | 131 ++++++++++++++---- 3 files changed, 173 insertions(+), 59 deletions(-) diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php index 924af2f26..fbeb85691 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -1448,6 +1448,49 @@ class Logbookadvanced_model extends CI_Model { } public function runCheckDb($type) { + switch ($type) { + case 'checkdistance': + return $this->check_missing_distance(); + case 'checkcontinent': + return $this->check_qsos_missing_continent(); + case 'checkdxcc': + return $this->check_missing_dxcc(); + return null; + } + } + + public function check_missing_dxcc() { + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + $sql = "select count(*) as count from " . $this->config->item('table_name') . " + join station_profile on " . $this->config->item('table_name') . ".station_id = station_profile.station_id + where " . $this->config->item('table_name') . ".station_id in (" . implode(',', array_map('intval', $logbooks_locations_array)) . ") + and user_id = ? and coalesce(col_dxcc, '') = ''"; + + $bindings[] = [$this->session->userdata('user_id')]; + + $query = $this->db->query($sql, $bindings); + return $query->result(); + } + + public function check_qsos_missing_continent() { + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + $sql = "select count(*) as count from " . $this->config->item('table_name') . " + join station_profile on " . $this->config->item('table_name') . ".station_id = station_profile.station_id + where " . $this->config->item('table_name') . ".station_id in (" . implode(',', array_map('intval', $logbooks_locations_array)) . ") + and user_id = ? + and (coalesce(col_cont, '') = '' or col_cont not in ('AF', 'AN', 'AS', 'EU', 'NA', 'OC', 'SA'))"; + + $bindings[] = [$this->session->userdata('user_id')]; + + $query = $this->db->query($sql, $bindings); + return $query->result(); + } + + public function check_missing_distance() { $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); diff --git a/application/views/logbookadvanced/dbtoolsdialog.php b/application/views/logbookadvanced/dbtoolsdialog.php index e1ae53af0..bca0ea9d0 100644 --- a/application/views/logbookadvanced/dbtoolsdialog.php +++ b/application/views/logbookadvanced/dbtoolsdialog.php @@ -9,11 +9,11 @@= __("Update missing or incorrect CQ zone information") ?>
= __("Update missing or incorrect ITU zone information") ?>
= __("Update missing or incorrect continent information") ?>
= __("Update missing or incorrect state/province information") ?>
= __("Calculate and update distance information for QSOs") ?>
= __("Identify QSOs that are missing DXCC information") ?>
= __("Use Wavelog to determine DXCC for all QSOs. This will overwrite existing DXCC information.") ?>
+= __("Use Wavelog to determine DXCC for all QSOs.") ?>
+= __("This will overwrite existing DXCC information!") ?>
QSO to update found: ' + (response[0].count) + '
'; + url: base_url + 'index.php/logbookadvanced/checkDb', + data: { + type: 'checkdistance' + }, + type: 'POST', + success: function(response) { + $('#checkUpdateDistancesBtn').prop("disabled", false).removeClass("running"); + $('#closeButton').prop("disabled", false); + // Create a nice display for the results + let resultHtml = 'QSO to update found: ' + (response[0].count) + '
'; - $('.result').html(resultHtml); - }, - error: function(xhr, status, error) { - $('#checkUpdateDistancesBtn').prop('disabled', false).text('= __("Check") ?>'); - $('#closeButton').prop('disabled', false); + $('.result').html(resultHtml); + }, + error: function(xhr, status, error) { + $('#checkUpdateDistancesBtn').prop('disabled', false).text('= __("Check") ?>'); + $('#closeButton').prop('disabled', false); - let errorMsg = '= __("Error checking distance information") ?>'; - if (xhr.responseJSON && xhr.responseJSON.message) { - errorMsg += ': ' + xhr.responseJSON.message; + let errorMsg = '= __("Error checking distance information") ?>'; + if (xhr.responseJSON && xhr.responseJSON.message) { + errorMsg += ': ' + xhr.responseJSON.message; + } + + BootstrapDialog.alert({ + title: '= __("Error") ?>', + message: errorMsg, + type: BootstrapDialog.TYPE_DANGER + }); } - - BootstrapDialog.alert({ - title: '= __("Error") ?>', - message: errorMsg, - type: BootstrapDialog.TYPE_DANGER - }); - } - }); - - + }); + } + + function checkMissingDxcc() { + $('#checkMissingDxccsBtn').prop("disabled", true).addClass("running"); + $('#closeButton').prop("disabled", true); + + + $.ajax({ + url: base_url + 'index.php/logbookadvanced/checkDb', + data: { + type: 'checkdxcc' + }, + type: 'POST', + success: function(response) { + $('#checkMissingDxccsBtn').prop("disabled", false).removeClass("running"); + $('#closeButton').prop("disabled", false); + // Create a nice display for the results + let resultHtml = 'QSOs without DXCC information found: ' + (response[0].count) + '
'; + + $('.result').html(resultHtml); + }, + error: function(xhr, status, error) { + $('#checkMissingDxccsBtn').prop('disabled', false).text('= __("Check") ?>'); + $('#closeButton').prop('disabled', false); + + let errorMsg = '= __("Error checking distance information") ?>'; + if (xhr.responseJSON && xhr.responseJSON.message) { + errorMsg += ': ' + xhr.responseJSON.message; + } + + BootstrapDialog.alert({ + title: '= __("Error") ?>', + message: errorMsg, + type: BootstrapDialog.TYPE_DANGER + }); + } + }); + } + + function checkFixContinent() { + $('#checkFixContinentBtn').prop("disabled", true).addClass("running"); + $('#closeButton').prop("disabled", true); + + $.ajax({ + url: base_url + 'index.php/logbookadvanced/checkDb', + data: { + type: 'checkcontinent' + }, + type: 'POST', + success: function(response) { + $('#checkFixContinentBtn').prop("disabled", false).removeClass("running"); + $('#closeButton').prop("disabled", false); + // Create a nice display for the results + let resultHtml = 'QSOs without missing or invalid continent information found: ' + (response[0].count) + '
'; + + $('.result').html(resultHtml); + }, + error: function(xhr, status, error) { + $('#checkFixContinentBtn').prop('disabled', false).text('= __("Check") ?>'); + $('#closeButton').prop('disabled', false); + + let errorMsg = '= __("Error checking distance information") ?>'; + if (xhr.responseJSON && xhr.responseJSON.message) { + errorMsg += ': ' + xhr.responseJSON.message; + } + + BootstrapDialog.alert({ + title: '= __("Error") ?>', + message: errorMsg, + type: BootstrapDialog.TYPE_DANGER + }); + } + }); } From 2ddf698af7c4c45e06fe6a446f7f346180f76011 Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Sun, 7 Dec 2025 15:55:52 +0100 Subject: [PATCH 03/79] Added state check --- application/controllers/Logbookadvanced.php | 14 +++- application/models/Logbookadvanced_model.php | 22 ++++++ .../views/logbookadvanced/checkresult.php | 38 ++++++++++ assets/js/sections/logbookadvanced.js | 73 ++++++++++++++++++- 4 files changed, 142 insertions(+), 5 deletions(-) create mode 100644 application/views/logbookadvanced/checkresult.php diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php index 301bf6139..1ca6422da 100644 --- a/application/controllers/Logbookadvanced.php +++ b/application/controllers/Logbookadvanced.php @@ -893,10 +893,16 @@ class Logbookadvanced extends CI_Controller { if(!clubaccess_check(9)) return; $type = $this->input->post('type', true); - $this->load->model('logbookadvanced_model'); - $result = $this->logbookadvanced_model->runCheckDb($type); - header("Content-Type: application/json"); - print json_encode($result); + + if ($type == 'checkstate') { + $data['result'] = $this->logbookadvanced_model->runCheckDb($type); + $this->load->view('logbookadvanced/checkresult', $data); + } else { + $result = $this->logbookadvanced_model->runCheckDb($type); + header("Content-Type: application/json"); + echo json_encode($result); + } + } } diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php index fbeb85691..0124843fa 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -1455,6 +1455,8 @@ class Logbookadvanced_model extends CI_Model { return $this->check_qsos_missing_continent(); case 'checkdxcc': return $this->check_missing_dxcc(); + case 'checkstate': + return $this->check_missing_state(); return null; } } @@ -1504,4 +1506,24 @@ class Logbookadvanced_model extends CI_Model { $query = $this->db->query($sql, $bindings); return $query->result(); } + + public function check_missing_state() { + $this->load->library('Geojson'); + $supported_dxcc_list = $this->geojson->getSupportedDxccs(); + $supported_dxcc_array = array_keys($supported_dxcc_list); + + $sql = "select count(*) as count, col_dxcc, dxcc_entities.name as dxcc_name, dxcc_entities.prefix from " . $this->config->item('table_name') . " + join station_profile on " . $this->config->item('table_name') . ".station_id = station_profile.station_id + join dxcc_entities on " . $this->config->item('table_name') . ".col_dxcc = dxcc_entities.adif + where user_id = ? and coalesce(col_state, '') = '' + and col_dxcc in (" . implode(',', array_map('intval', $supported_dxcc_array)) . ") + and length(col_gridsquare) >= 6 + group by col_dxcc, dxcc_entities.name, dxcc_entities.prefix + order by dxcc_entities.prefix"; + + $bindings[] = [$this->session->userdata('user_id')]; + + $query = $this->db->query($sql, $bindings); + return $query->result(); + } } diff --git a/application/views/logbookadvanced/checkresult.php b/application/views/logbookadvanced/checkresult.php new file mode 100644 index 000000000..e1a86a04d --- /dev/null +++ b/application/views/logbookadvanced/checkresult.php @@ -0,0 +1,38 @@ + 0): ?> +QSOs with missing state and gridsquares with 6 or more characters found for the following DXCC's:
+ +| Prefix | +DXCC | +QSOs | +
|---|---|---|
| prefix; ?> | ++ | + |
No issues found. All QSOs have proper state information.
+QSOs without missing or invalid continent information found: ' + (response[0].count) + '
'; + resultHtml += 'QSOs with missing or invalid continent information found: ' + (response[0].count) + '
'; $('.result').html(resultHtml); }, @@ -2140,3 +2140,74 @@ function saveOptions() { } }); } + + function checkFixState() { + $('#checkFixStateBtn').prop("disabled", true).addClass("running"); + $('#closeButton').prop("disabled", true); + + $.ajax({ + url: base_url + 'index.php/logbookadvanced/checkDb', + data: { + type: 'checkstate' + }, + type: 'POST', + success: function(response) { + $('#checkFixStateBtn').prop("disabled", false).removeClass("running"); + $('#closeButton').prop("disabled", false); + + $('.result').html(response); + }, + error: function(xhr, status, error) { + $('#checkFixStateBtn').prop('disabled', false).text('= __("Check") ?>'); + $('#closeButton').prop('disabled', false); + + let errorMsg = '= __("Error checking distance information") ?>'; + if (xhr.responseJSON && xhr.responseJSON.message) { + errorMsg += ': ' + xhr.responseJSON.message; + } + + BootstrapDialog.alert({ + title: '= __("Error") ?>', + message: errorMsg, + type: BootstrapDialog.TYPE_DANGER + }); + } + }); + } + + function checkFixState2() { + $('#checkFixStateBtn').prop("disabled", true).addClass("running"); + $('#closeButton').prop("disabled", true); + + $.ajax({ + url: base_url + 'index.php/logbookadvanced/checkDb', + data: { + type: 'checkstate' + }, + type: 'POST', + success: function(response) { + $('#checkFixStateBtn').prop("disabled", false).removeClass("running"); + $('#closeButton').prop("disabled", false); + // Create a nice display for the results + let resultHtml = 'QSOs with missing state and gridsquares with 6 or more characters found: ' + (response[0].count) + '
'; + + $('.result').html(resultHtml); + }, + error: function(xhr, status, error) { + $('#checkFixStateBtn').prop('disabled', false).text('= __("Check") ?>'); + $('#closeButton').prop('disabled', false); + + let errorMsg = '= __("Error checking distance information") ?>'; + if (xhr.responseJSON && xhr.responseJSON.message) { + errorMsg += ': ' + xhr.responseJSON.message; + } + + BootstrapDialog.alert({ + title: '= __("Error") ?>', + message: errorMsg, + type: BootstrapDialog.TYPE_DANGER + }); + } + }); + } From 0fad755ce6f2c08893ca749fd7f15e3a8f1cdfad Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Sun, 7 Dec 2025 19:52:26 +0100 Subject: [PATCH 04/79] Implemented batch state fixer --- application/controllers/Logbookadvanced.php | 15 ++++ application/libraries/Geojson.php | 9 ++ application/models/Logbookadvanced_model.php | 82 +++++++++++++++---- .../views/logbookadvanced/checkresult.php | 22 +++-- .../views/logbookadvanced/dbtoolsdialog.php | 24 ++---- assets/js/sections/logbookadvanced.js | 78 +++++++++++++++--- 6 files changed, 178 insertions(+), 52 deletions(-) diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php index 1ca6422da..4a6d417b2 100644 --- a/application/controllers/Logbookadvanced.php +++ b/application/controllers/Logbookadvanced.php @@ -905,4 +905,19 @@ class Logbookadvanced extends CI_Controller { } } + + public function fixStateBatch() { + if(!clubaccess_check(9)) return; + + $this->load->model('logbook_model'); + $this->load->model('logbookadvanced_model'); + + $dxcc = $this->input->post('dxcc', true); + + // Process for batch QSO state fix + $result = $this->logbookadvanced_model->fixStateBatch($dxcc); + + header("Content-Type: application/json"); + echo json_encode($result); + } } diff --git a/application/libraries/Geojson.php b/application/libraries/Geojson.php index 618143f42..c832fcbe5 100644 --- a/application/libraries/Geojson.php +++ b/application/libraries/Geojson.php @@ -134,6 +134,15 @@ class Geojson { return isset(self::SUPPORTED_STATES[$dxcc]) && self::SUPPORTED_STATES[$dxcc]['enabled'] === true; } + /** + * Retrieve list of DXCC entities that support state/province lookups + * + * @return array List of supported DXCC entities + */ + public function getSupportedDxccs() { + return self::SUPPORTED_STATES; + } + // ============================================================================ // COORDINATE CONVERSION // ============================================================================ diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php index 0124843fa..3dfe433bf 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -1457,18 +1457,18 @@ class Logbookadvanced_model extends CI_Model { return $this->check_missing_dxcc(); case 'checkstate': return $this->check_missing_state(); + case 'checkcqzones': + return $this->check_missing_cq_zones(); + case 'checkituzones': + return $this->check_missing_itu_zones(); return null; } } public function check_missing_dxcc() { - $this->load->model('logbooks_model'); - $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - $sql = "select count(*) as count from " . $this->config->item('table_name') . " join station_profile on " . $this->config->item('table_name') . ".station_id = station_profile.station_id - where " . $this->config->item('table_name') . ".station_id in (" . implode(',', array_map('intval', $logbooks_locations_array)) . ") - and user_id = ? and coalesce(col_dxcc, '') = ''"; + where user_id = ? and coalesce(col_dxcc, '') = ''"; $bindings[] = [$this->session->userdata('user_id')]; @@ -1477,13 +1477,9 @@ class Logbookadvanced_model extends CI_Model { } public function check_qsos_missing_continent() { - $this->load->model('logbooks_model'); - $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - $sql = "select count(*) as count from " . $this->config->item('table_name') . " join station_profile on " . $this->config->item('table_name') . ".station_id = station_profile.station_id - where " . $this->config->item('table_name') . ".station_id in (" . implode(',', array_map('intval', $logbooks_locations_array)) . ") - and user_id = ? + where user_id = ? and (coalesce(col_cont, '') = '' or col_cont not in ('AF', 'AN', 'AS', 'EU', 'NA', 'OC', 'SA'))"; $bindings[] = [$this->session->userdata('user_id')]; @@ -1493,13 +1489,9 @@ class Logbookadvanced_model extends CI_Model { } public function check_missing_distance() { - $this->load->model('logbooks_model'); - $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - $sql = "select count(*) as count from " . $this->config->item('table_name') . " join station_profile on " . $this->config->item('table_name') . ".station_id = station_profile.station_id - where " . $this->config->item('table_name') . ".station_id in (" . implode(',', array_map('intval', $logbooks_locations_array)) . ") - and user_id = ? and coalesce(col_distance, '') = ''"; + where user_id = ? and coalesce(col_distance, '') = ''"; $bindings[] = [$this->session->userdata('user_id')]; @@ -1526,4 +1518,64 @@ class Logbookadvanced_model extends CI_Model { $query = $this->db->query($sql, $bindings); return $query->result(); } + + public function check_missing_cq_zones() { + $sql = "select count(*) as count from " . $this->config->item('table_name') . " + join station_profile on " . $this->config->item('table_name') . ".station_id = station_profile.station_id + where user_id = ? and coalesce(col_cqz, '') = ''"; + + $bindings[] = [$this->session->userdata('user_id')]; + + $query = $this->db->query($sql, $bindings); + return $query->result(); + } + + public function check_missing_itu_zones() { + $sql = "select count(*) as count from " . $this->config->item('table_name') . " + join station_profile on " . $this->config->item('table_name') . ".station_id = station_profile.station_id + where user_id = ? and coalesce(col_ituz, '') = ''"; + + $bindings[] = [$this->session->userdata('user_id')]; + + $query = $this->db->query($sql, $bindings); + return $query->result(); + } + + /** + * Fix state for a batch of QSOs using GeoJSON lookup + * + * @param int $dxcc DXCC entity number for which to fix states + * @return array Result array with success, dxcc_name, dxcc_number, state_code, skipped + */ + function fixStateBatch($dxcc) { + $this->load->library('Geojson'); + + // Get QSO data + $sql = "SELECT COL_PRIMARY_KEY, COL_CALL, COL_GRIDSQUARE, COL_DXCC, COL_STATE, d.name as dxcc_name + FROM " . $this->config->item('table_name') . " qsos + JOIN station_profile ON qsos.station_id = station_profile.station_id + LEFT JOIN dxcc_entities d ON qsos.COL_DXCC = d.adif + WHERE qsos.COL_DXCC = ? AND station_profile.user_id = ? + AND (qsos.COL_STATE IS NULL OR qsos.COL_STATE = '') + AND LENGTH(COALESCE(qsos.COL_GRIDSQUARE, '')) >= 6"; + + $query = $this->db->query($sql, [$dxcc, $this->session->userdata('user_id')]); + + if ($query->num_rows() === 0) { + return [ + 'success' => false, + 'skipped' => true, + 'reason' => 'QSOs not found' + ]; + } + + $results = []; + + foreach ($query->result() as $qso) { + $result = $this->fixStateSingle($qso->COL_PRIMARY_KEY); + $results []= $result; + } + + return $results; + } } diff --git a/application/views/logbookadvanced/checkresult.php b/application/views/logbookadvanced/checkresult.php index e1a86a04d..10dc34aa1 100644 --- a/application/views/logbookadvanced/checkresult.php +++ b/application/views/logbookadvanced/checkresult.php @@ -1,15 +1,16 @@ 0): ?>QSOs with missing state and gridsquares with 6 or more characters found for the following DXCC's:
+= __("QSOs with missing state and gridsquares with 6 or more characters found for the following DXCC's:"); ?>
-| Prefix | -DXCC | -QSOs | += __("Prefix"); ?> | += __("DXCC"); ?> | += __("QSOs"); ?> | += __("Action"); ?> | prefix; ?> | + |
+ |
@@ -32,7 +38,7 @@
- |
diff --git a/application/views/logbookadvanced/showStateQsos.php b/application/views/logbookadvanced/showStateQsos.php
new file mode 100644
index 000000000..040692c43
--- /dev/null
+++ b/application/views/logbookadvanced/showStateQsos.php
@@ -0,0 +1,38 @@
+
|---|
| Call | +Date/Time | +Mode | +Submode | +Band | +State | +Gridsquare | +
|---|---|---|---|---|---|---|
| col_call; ?> | +col_time_on)); ?> | +col_mode; ?> | +col_submode ?? ''; ?> | +col_band; ?> | +col_state; ?> | +col_gridsquare; ?> | +
+ Found QSO(s) missing state information for DXCC . +
+= __("Use Wavelog to determine DXCC for all QSOs.") ?>
-= __("This will overwrite existing DXCC information!") ?>
+= __("This will overwrite ALL existing DXCC information!") ?>
The Database Tools module in Wavelog provides a comprehensive suite of utilities for maintaining data integrity and repairing common issues in your logbook data. These tools are accessible through the Advanced Logbook interface and are designed to help operators keep their QSO records accurate and complete.
+ +DBTools offers automated checking and fixing functionality for various types of QSO metadata that may be missing, incorrect, or outdated. The tools perform validation against authoritative sources and provide batch processing capabilities to efficiently handle large logbooks.
+ ++ Found QSO(s) missing state information for DXCC . +
| Call | Date/Time | Mode | -Submode | Band | -State | Gridsquare | +DXCC | +Station | col_call; ?> | col_time_on)); ?> | col_mode; ?> | -col_submode ?? ''; ?> | col_band; ?> | -col_state; ?> | col_gridsquare; ?> | +dxcc_name), "- (/"), ENT_QUOTES, 'UTF-8'); ?> | +station_profile_name; ?> |
|---|
- Found QSO(s) missing state information for DXCC . -
-
- = __("After updating, Wavelog can fill in missing callsign information in the logbook using the newly-obtained DXCC data.
- You can choose to check just the QSOs in the logbook that are missing DXCC metadata or to re-check the entire logbook
- and update existing metadata as well, in case it has changed."); ?>
-
= __("WARNING"); ?>: = __("This affects ALL QSOs of ANY user on this instance. The function is deprectated and will be removed in a future version of Wavelog. As replacement use the Logbook-Advanced!"); ?>
-
= __("This will overwrite ALL existing DXCC information!") ?>
= __("QSOs with missing state and gridsquares with 6 or more characters found for the following DXCC's:"); ?>
+ -| = __("Prefix"); ?> | -= __("DXCC"); ?> | -= __("QSOs"); ?> | -= __("Action"); ?> | -
|---|---|---|---|
| prefix; ?> | -- | - |
- |
-
= __("No QSOs were found where state information can be fixed."); ?>
-= __("QSOs with missing state and gridsquares with 6 or more characters found for the following DXCC's:"); ?>
+ +| = __("Prefix"); ?> | += __("DXCC"); ?> | += __("QSOs"); ?> | += __("Action"); ?> | +
|---|---|---|---|
| prefix; ?> | ++ | + |
+ |
+
= __("No QSOs were found where state information can be fixed."); ?>
+QSO to update found: ' + (response[0].count) + '
'; - $('.result').html(resultHtml); + $('.result').html(response); }, error: function(xhr, status, error) { - $('#checkUpdateDistancesBtn').prop('disabled', false).text('= __("Check") ?>'); + $('#checkUpdateDistancesBtn').prop("disabled", false).removeClass("running"); $('#closeButton').prop('disabled', false); - let errorMsg = '= __("Error checking distance information") ?>'; + let errorMsg = 'Error checking distance information'; if (xhr.responseJSON && xhr.responseJSON.message) { errorMsg += ': ' + xhr.responseJSON.message; } BootstrapDialog.alert({ - title: '= __("Error") ?>', + title: 'Error', message: errorMsg, type: BootstrapDialog.TYPE_DANGER }); @@ -2070,7 +2066,6 @@ function saveOptions() { $('#checkMissingDxccsBtn').prop("disabled", true).addClass("running"); $('#closeButton').prop("disabled", true); - $.ajax({ url: base_url + 'index.php/logbookadvanced/checkDb', data: { @@ -2080,23 +2075,19 @@ function saveOptions() { success: function(response) { $('#checkMissingDxccsBtn').prop("disabled", false).removeClass("running"); $('#closeButton').prop("disabled", false); - // Create a nice display for the results - let resultHtml = 'QSOs without DXCC information found: ' + (response[0].count) + '
'; - - $('.result').html(resultHtml); + $('.result').html(response); }, error: function(xhr, status, error) { $('#checkMissingDxccsBtn').prop('disabled', false).text('= __("Check") ?>'); $('#closeButton').prop('disabled', false); - let errorMsg = '= __("Error checking distance information") ?>'; + let errorMsg = 'Error checking DXCC information'; if (xhr.responseJSON && xhr.responseJSON.message) { errorMsg += ': ' + xhr.responseJSON.message; } BootstrapDialog.alert({ - title: '= __("Error") ?>', + title: 'Error', message: errorMsg, type: BootstrapDialog.TYPE_DANGER }); @@ -2117,23 +2108,19 @@ function saveOptions() { success: function(response) { $('#checkFixContinentBtn').prop("disabled", false).removeClass("running"); $('#closeButton').prop("disabled", false); - // Create a nice display for the results - let resultHtml = 'QSOs with missing or invalid continent information found: ' + (response[0].count) + '
'; - - $('.result').html(resultHtml); + $('.result').html(response); }, error: function(xhr, status, error) { $('#checkFixContinentBtn').prop('disabled', false).text('= __("Check") ?>'); $('#closeButton').prop('disabled', false); - let errorMsg = '= __("Error checking distance information") ?>'; + let errorMsg = 'Error checking continent information'; if (xhr.responseJSON && xhr.responseJSON.message) { errorMsg += ': ' + xhr.responseJSON.message; } BootstrapDialog.alert({ - title: '= __("Error") ?>', + title: 'Error', message: errorMsg, type: BootstrapDialog.TYPE_DANGER }); @@ -2161,13 +2148,13 @@ function saveOptions() { $('#checkFixStateBtn').prop('disabled', false).text('= __("Check") ?>'); $('#closeButton').prop('disabled', false); - let errorMsg = '= __("Error checking distance information") ?>'; + let errorMsg = 'Error checking state information'; if (xhr.responseJSON && xhr.responseJSON.message) { errorMsg += ': ' + xhr.responseJSON.message; } BootstrapDialog.alert({ - title: '= __("Error") ?>', + title: 'Error', message: errorMsg, type: BootstrapDialog.TYPE_DANGER }); @@ -2188,11 +2175,7 @@ function saveOptions() { success: function(response) { $('#checkFixCqZonesBtn').prop("disabled", false).removeClass("running"); $('#closeButton').prop("disabled", false); - // Create a nice display for the results - let resultHtml = 'QSOs with missing CQ zone information found: ' + (response[0].count) + '
'; - - $('.result').html(resultHtml); + $('.result').html(response); }, error: function(xhr, status, error) { $('#checkFixCqZonesBtn').prop('disabled', false).text('= __("Check") ?>'); @@ -2204,7 +2187,7 @@ function saveOptions() { } BootstrapDialog.alert({ - title: '= __("Error") ?>', + title: 'Error', message: errorMsg, type: BootstrapDialog.TYPE_DANGER }); @@ -2225,11 +2208,7 @@ function saveOptions() { success: function(response) { $('#checkFixItuZonesBtn').prop("disabled", false).removeClass("running"); $('#closeButton').prop("disabled", false); - // Create a nice display for the results - let resultHtml = 'QSOs with missing ITU zone information found: ' + (response[0].count) + '
'; - - $('.result').html(resultHtml); + $('.result').html(response); }, error: function(xhr, status, error) { $('#checkFixItuZonesBtn').prop('disabled', false).text('= __("Check") ?>'); @@ -2241,7 +2220,7 @@ function saveOptions() { } BootstrapDialog.alert({ - title: '= __("Error") ?>', + title: 'Error', message: errorMsg, type: BootstrapDialog.TYPE_DANGER }); From e2194257ff8ccd96e5b7a08ffd6a95484033999c Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Mon, 8 Dec 2025 20:58:39 +0100 Subject: [PATCH 11/79] Added Run buttons --- .../views/logbookadvanced/checkresult.php | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/application/views/logbookadvanced/checkresult.php b/application/views/logbookadvanced/checkresult.php index f105fe2dd..73d4f7a05 100644 --- a/application/views/logbookadvanced/checkresult.php +++ b/application/views/logbookadvanced/checkresult.php @@ -23,24 +23,44 @@ switch ($type) { function check_missing_distance($result) { ?>= __("This will overwrite ALL existing DXCC information!") ?>
+ Found QSO(s) missing DXCC information. +
+| Call | +Date/Time | +Mode | +Band | +State | +Gridsquare | +DXCC | +Station | +
|---|---|---|---|---|---|---|---|
| col_primary_key . ')">' . htmlspecialchars($qso->col_call) . ''; ?> | +col_time_on)); ?> | +col_mode; ?> | +col_band; ?> | +col_state; ?> | +col_gridsquare; ?> | +dxcc_name; ?> | +station_profile_name; ?> | +
= __("Update missing or incorrect state/province information") ?>
+= __("Update missing state/province information") ?>
= __("Update missing or incorrect CQ zone information") ?>
+= __("Update missing CQ zone information") ?>
= __("Update missing or incorrect ITU zone information") ?>
+= __("Update missing ITU zone information") ?>
| Call | -Date/Time | -Mode | -Band | -State | -Gridsquare | -DXCC | -Station | += __("Call") ?> | += __("Date/Time") ?> | += __("Mode") ?> | += __("Band") ?> | += __("State") ?> | += __("Gridsquare") ?> | += __("DXCC") ?> | += __("Station") ?> |
|---|
| Call | -Date/Time | -Mode | -Band | -State | -Gridsquare | -DXCC | -Station | += __("Call") ?> | += __("Date/Time") ?> | += __("Mode") ?> | += __("Band") ?> | += __("State") ?> | += __("Gridsquare") ?> | += __("DXCC") ?> | += __("Station") ?> |
- ' + response.message + ' ');
},
error: function () {
$('#fixStateBtn_' + dxcc).prop("disabled", false).removeClass("running");
From e4721c1b2b45f5588a3231e77a9def22aa55faa3 Mon Sep 17 00:00:00 2001
From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com>
Date: Sun, 14 Dec 2025 22:07:27 +0100
Subject: [PATCH 55/79] Fixed state update count
---
application/models/Logbookadvanced_model.php | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php
index 4ee468e17..f35db9ef7 100644
--- a/application/models/Logbookadvanced_model.php
+++ b/application/models/Logbookadvanced_model.php
@@ -1600,7 +1600,9 @@ class Logbookadvanced_model extends CI_Model {
foreach ($query->result() as $qso) {
$result = $this->fixStateSingle($qso->COL_PRIMARY_KEY);
- $results []= $result;
+ if ($result['success']) {
+ $results []= $result;
+ }
}
return $results;
From fbeeba77510150bc3cbacaa3d2c660b83583ba20 Mon Sep 17 00:00:00 2001
From: github-actions (9dl{O=U*b)84$ETo5g}qd(WD)Oo{$sJ-S8L| z!)55U+lemKA!O |
|---|