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/40] [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 8b963fefa8..301bf6139d 100644 --- a/application/controllers/Logbookadvanced.php +++ b/application/controllers/Logbookadvanced.php @@ -884,4 +884,19 @@ public function updateDistances() { 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 f283af0580..924af2f266 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -1446,4 +1446,19 @@ public function update_distances_batch() { 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 0000000000..e1ae53af00 --- /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/40] 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 | 127 ++++++++++++++---- 3 files changed, 171 insertions(+), 57 deletions(-) diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php index 924af2f266..fbeb85691a 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -1448,6 +1448,49 @@ public function update_distances_batch() { } 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 e1ae53af00..bca0ea9d05 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) + '
'; - - $('.result').html(resultHtml); - }, - error: function(xhr, status, error) { - $('#checkUpdateDistancesBtn').prop('disabled', false).text('= __("Check") ?>'); - $('#closeButton').prop('disabled', false); + 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) + '
'; - let errorMsg = '= __("Error checking distance information") ?>'; - if (xhr.responseJSON && xhr.responseJSON.message) { - errorMsg += ': ' + xhr.responseJSON.message; + $('.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 + }); } + }); + } - 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/40] 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 301bf6139d..1ca6422da9 100644 --- a/application/controllers/Logbookadvanced.php +++ b/application/controllers/Logbookadvanced.php @@ -893,10 +893,16 @@ 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); + + 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 fbeb85691a..0124843fae 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -1455,6 +1455,8 @@ public function runCheckDb($type) { 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 @@ public function check_missing_distance() { $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 0000000000..e1a86a04d2 --- /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/40] 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 1ca6422da9..4a6d417b26 100644 --- a/application/controllers/Logbookadvanced.php +++ b/application/controllers/Logbookadvanced.php @@ -905,4 +905,19 @@ public function checkDb() { } } + + 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 618143f422..c832fcbe56 100644 --- a/application/libraries/Geojson.php +++ b/application/libraries/Geojson.php @@ -134,6 +134,15 @@ public function isStateSupported($dxcc) { 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 0124843fae..3dfe433bfe 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -1457,18 +1457,18 @@ public function runCheckDb($type) { 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 @@ public function check_missing_dxcc() { } 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 @@ public function check_qsos_missing_continent() { } 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 @@ public function check_missing_state() { $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 e1a86a04d2..10dc34aa11 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 0000000000..040692c437
--- /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/40] 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 f105fe2ddf..73d4f7a05b 100644 --- a/application/views/logbookadvanced/checkresult.php +++ b/application/views/logbookadvanced/checkresult.php @@ -23,24 +23,44 @@ 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 26/40] 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 4ee468e17c..f35db9ef71 100644
--- a/application/models/Logbookadvanced_model.php
+++ b/application/models/Logbookadvanced_model.php
@@ -1600,7 +1600,9 @@ function fixStateBatch($dxcc) {
foreach ($query->result() as $qso) {
$result = $this->fixStateSingle($qso->COL_PRIMARY_KEY);
- $results []= $result;
+ if ($result['success']) {
+ $results []= $result;
+ }
}
return $results;
From 6a746b6eaf27a9650ff6d525d7a90a620c23bb7c Mon Sep 17 00:00:00 2001
From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com>
Date: Mon, 15 Dec 2025 08:31:04 +0100
Subject: [PATCH 27/40] Red if 0, green if > 0
---
application/controllers/Logbookadvanced.php | 2 ++
assets/js/sections/logbookadvanced.js | 4 ++++
2 files changed, 6 insertions(+)
diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php
index 6d6f512e4b..31d258b93f 100644
--- a/application/controllers/Logbookadvanced.php
+++ b/application/controllers/Logbookadvanced.php
@@ -916,6 +916,8 @@ public function fixStateBatch() {
// Process for batch QSO state fix
$result = $this->logbookadvanced_model->fixStateBatch($dxcc);
+ $data['result'] = count($result);
+
$data['message'] = __("The number of QSOs updated for state/province in") . ' ' . $country . ' : ' . count($result);
header("Content-Type: application/json");
diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js
index a60672cf2b..11c70944d9 100644
--- a/assets/js/sections/logbookadvanced.js
+++ b/assets/js/sections/logbookadvanced.js
@@ -2188,6 +2188,10 @@ function saveOptions() {
},
success: function (response) {
$('#fixStateBtn_' + dxcc).prop("disabled", false).removeClass("running");
+ if (response.result == 0) {
+ $('.result').html('' + response.message + ' ');
+ return;
+ }
$('.result').html('' + response.message + ' ');
},
error: function () {
From 9d29f7e07640e09b93054f21d48d0c49f22c098d Mon Sep 17 00:00:00 2001
From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com>
Date: Mon, 15 Dec 2025 09:14:25 +0100
Subject: [PATCH 28/40] Fixed return messages for dxcc update
---
application/controllers/Logbookadvanced.php | 9 ++++++---
assets/js/sections/logbookadvanced.js | 12 ++++++++++--
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php
index 31d258b93f..0945a6d9cc 100644
--- a/application/controllers/Logbookadvanced.php
+++ b/application/controllers/Logbookadvanced.php
@@ -944,12 +944,15 @@ public function fixMissingDxcc() {
$this->load->model('logbookadvanced_model');
$result = $this->logbookadvanced_model->check_missing_dxcc_id($all);
- header("Content-Type: application/json");
+ $data['result'] = $result;
+
if ($all == 'false') {
- echo json_encode(__("The number of QSOs updated for missing DXCC IDs was") .' ' . $result);
+ $data['message'] = __("The number of QSOs updated for missing DXCC IDs was") .' ' . $result;
} else {
- echo json_encode(__("The number of QSOs re-checked for DXCC was") .' ' . $result);
+ $data['message'] = __("The number of QSOs re-checked for DXCC was") .' ' . $result;
}
+ header("Content-Type: application/json");
+ echo json_encode($data);
}
public function openMissingDxccList() {
diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js
index 11c70944d9..1bd6e3c69c 100644
--- a/assets/js/sections/logbookadvanced.js
+++ b/assets/js/sections/logbookadvanced.js
@@ -2258,8 +2258,12 @@ function saveOptions() {
},
success: function(data) {
$('#updateDxccBtn').prop("disabled", false).removeClass("running");
- $('.result').html(data);
$('#closeButton').prop("disabled", false);
+ if (data.result == 0) {
+ $('.result').html('' + data.message + ' ');
+ return;
+ }
+ $('.result').html('' + data.message + ' ');
},
error: function(xhr, status, error) {
$('#updateDxccBtn').prop("disabled", false).removeClass("running");
@@ -2284,8 +2288,12 @@ function saveOptions() {
},
success: function(data) {
$('#fixMissingDxccBtn').prop("disabled", false).removeClass("running");
- $('.result').html(data);
$('#closeButton').prop("disabled", false);
+ if (data.result == 0) {
+ $('.result').html('' + data.message + ' ');
+ return;
+ }
+ $('.result').html('' + data.message + ' ');
},
error: function(xhr, status, error) {
$('#fixMissingDxccBtn').prop("disabled", false).removeClass("running");
From 90daf3ae0d071c3b84a5f86dd6f3e226ad7fb846 Mon Sep 17 00:00:00 2001
From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com>
Date: Mon, 15 Dec 2025 16:51:11 +0100
Subject: [PATCH 29/40] More verbose message on dxcc and state fixer
---
application/controllers/Logbookadvanced.php | 19 ++--
application/models/Logbookadvanced_model.php | 19 +++-
.../logbookadvanced/showUpdateResult.php | 105 ++++++++++++++++++
assets/js/sections/logbookadvanced.js | 18 +--
4 files changed, 132 insertions(+), 29 deletions(-)
create mode 100644 application/views/logbookadvanced/showUpdateResult.php
diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php
index 0945a6d9cc..3f72bb67be 100644
--- a/application/controllers/Logbookadvanced.php
+++ b/application/controllers/Logbookadvanced.php
@@ -911,17 +911,16 @@ public function fixStateBatch() {
$this->load->model('logbookadvanced_model');
$dxcc = $this->input->post('dxcc', true);
- $country = $this->input->post('country', true);
+ $data['country'] = $this->input->post('country', true);
// Process for batch QSO state fix
$result = $this->logbookadvanced_model->fixStateBatch($dxcc);
- $data['result'] = count($result);
+ $data['result'] = $result;
- $data['message'] = __("The number of QSOs updated for state/province in") . ' ' . $country . ' : ' . count($result);
+ $data['type'] = 'state';
- header("Content-Type: application/json");
- echo json_encode($data);
+ $this->load->view('logbookadvanced/showUpdateResult', $data);
}
public function openStateList() {
@@ -945,14 +944,10 @@ public function fixMissingDxcc() {
$result = $this->logbookadvanced_model->check_missing_dxcc_id($all);
$data['result'] = $result;
+ $data['all'] = $all;
+ $data['type'] = 'dxcc';
- if ($all == 'false') {
- $data['message'] = __("The number of QSOs updated for missing DXCC IDs was") .' ' . $result;
- } else {
- $data['message'] = __("The number of QSOs re-checked for DXCC was") .' ' . $result;
- }
- header("Content-Type: application/json");
- echo json_encode($data);
+ $this->load->view('logbookadvanced/showUpdateResult', $data);
}
public function openMissingDxccList() {
diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php
index f35db9ef71..b4b1ad1120 100644
--- a/application/models/Logbookadvanced_model.php
+++ b/application/models/Logbookadvanced_model.php
@@ -1598,13 +1598,19 @@ function fixStateBatch($dxcc) {
$results = [];
+ $count = 0;
+
foreach ($query->result() as $qso) {
$result = $this->fixStateSingle($qso->COL_PRIMARY_KEY);
if ($result['success']) {
+ $count++;
+ } else {
$results []= $result;
}
}
+ $results['count'] = $count;
+
return $results;
}
@@ -1652,14 +1658,23 @@ public function check_missing_dxcc_id($all = false) {
$qso_date = $row['COL_TIME_OFF'] == '' ? $row['COL_TIME_ON'] : $row['COL_TIME_OFF'];
$qso_date = date("Y-m-d", strtotime($qso_date));
$d = $this->logbook_model->check_dxcc_table($row['COL_CALL'], $qso_date);
- if ($d[0] != 'Not Found') {
+ if ($d[0] == 'Not Found') {
+ $result[] = [
+ 'callsign' => $row['COL_CALL'],
+ 'reason' => 'DXCC Not Found',
+ 'location' => '',
+ 'id' => $row['COL_PRIMARY_KEY']
+ ];
+ } else {
$q->execute(array(addslashes(ucwords(strtolower($d[1]), "- (/")), $d[0], $row['COL_PRIMARY_KEY']));
$count++;
}
}
}
$this->db->trans_complete();
- return $count;
+ $result['count'] = $count;
+
+ return $result;
}
function getMissingDxccQsos() {
diff --git a/application/views/logbookadvanced/showUpdateResult.php b/application/views/logbookadvanced/showUpdateResult.php
new file mode 100644
index 0000000000..a52c5c87cd
--- /dev/null
+++ b/application/views/logbookadvanced/showUpdateResult.php
@@ -0,0 +1,105 @@
+' . __("The number of QSOs updated for missing DXCC IDs was") .' ' . $result['count'] . '';
+ } else {
+ echo '' . __("The number of QSOs re-checked for DXCC was") .' ' . $result['count'] . ' ';
+ }
+ } else {
+ if ($all == 'false') {
+ echo '' . __("The number of QSOs updated for missing DXCC IDs was") .' ' . $result['count'] . ' ';
+ } else {
+ echo '' . __("The number of QSOs re-checked for DXCC was") .' ' . $result['count'] . ' ';
+ }
+ }
+
+ if ($result) {
+ echo __("These QSOs could not be updated:");
+ $details = [];
+ foreach ($result as $r) {
+ if (is_array($r)) {
+ $details[] = $r;
+ }
+ }
+
+ if (!empty($details)) {
+ echo '';
+ echo ' ';
+ }
+ }
+}
+
+function showStateUpdateResult($result, $country) {
+ if ($result['count'] == 0) {
+ echo '
' . __("The number of QSOs updated for state/province in") . ' ' . $country . ' : ' . $result['count'] . ' ';
+ } else {
+ echo '' . __("The number of QSOs updated for state/province in") . ' ' . $country . ' : ' . $result['count'] . ' ';
+ }
+
+ if ($result) {
+ echo __("These QSOs could not be updated:");
+ $details = [];
+ foreach ($result as $r) {
+ if (is_array($r)) {
+ $details[] = $r;
+ }
+ }
+
+ if (!empty($details)) {
+ echo '';
+ echo ' ';
+ }
+ }
+}
diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js
index 1bd6e3c69c..b83243d726 100644
--- a/assets/js/sections/logbookadvanced.js
+++ b/assets/js/sections/logbookadvanced.js
@@ -2188,11 +2188,7 @@ function saveOptions() {
},
success: function (response) {
$('#fixStateBtn_' + dxcc).prop("disabled", false).removeClass("running");
- if (response.result == 0) {
- $('.result').html('
' + response.message + ' ');
- return;
- }
- $('.result').html('' + response.message + ' ');
+ $('.result').html(response);
},
error: function () {
$('#fixStateBtn_' + dxcc).prop("disabled", false).removeClass("running");
@@ -2259,11 +2255,7 @@ function saveOptions() {
success: function(data) {
$('#updateDxccBtn').prop("disabled", false).removeClass("running");
$('#closeButton').prop("disabled", false);
- if (data.result == 0) {
- $('.result').html('' + data.message + ' ');
- return;
- }
- $('.result').html('' + data.message + ' ');
+ $('.result').html(data);
},
error: function(xhr, status, error) {
$('#updateDxccBtn').prop("disabled", false).removeClass("running");
@@ -2289,11 +2281,7 @@ function saveOptions() {
success: function(data) {
$('#fixMissingDxccBtn').prop("disabled", false).removeClass("running");
$('#closeButton').prop("disabled", false);
- if (data.result == 0) {
- $('.result').html('' + data.message + ' ');
- return;
- }
- $('.result').html('' + data.message + ' ');
+ $('.result').html(data);
},
error: function(xhr, status, error) {
$('#fixMissingDxccBtn').prop("disabled", false).removeClass("running");
From fc1993ba9f738d1aaef88bdb56a216970acfdd3f Mon Sep 17 00:00:00 2001
From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com>
Date: Mon, 15 Dec 2025 19:12:01 +0100
Subject: [PATCH 30/40] Fix disabled close button
---
assets/js/sections/logbookadvanced.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js
index b83243d726..a540567222 100644
--- a/assets/js/sections/logbookadvanced.js
+++ b/assets/js/sections/logbookadvanced.js
@@ -2375,6 +2375,7 @@ function saveOptions() {
message: lang_gen_advanced_logbook_continents_updated + ' ' + response + ' ' + lang_gen_advanced_logbook_records_updated,
type: BootstrapDialog.TYPE_SUCCESS
});
+ $('#closeButton').prop("disabled", false);
},
error: function () {
$('#updateContinentButton').prop("disabled", false).removeClass("running");
@@ -2386,6 +2387,7 @@ function saveOptions() {
message: lang_gen_advanced_logbook_problem_fixing_continents,
type: BootstrapDialog.TYPE_DANGER
});
+ $('#closeButton').prop("disabled", false);
}
});
}
From 325ada1b5477798b2ad0ba5ec2cb8e25c0fa141e Mon Sep 17 00:00:00 2001
From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com>
Date: Mon, 15 Dec 2025 19:36:56 +0100
Subject: [PATCH 31/40] Fixed continent return result
---
application/controllers/Logbookadvanced.php | 7 +++++--
.../views/logbookadvanced/showUpdateResult.php | 11 +++++++++++
assets/js/sections/logbookadvanced.js | 17 +++--------------
3 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php
index 3f72bb67be..a26716e68a 100644
--- a/application/controllers/Logbookadvanced.php
+++ b/application/controllers/Logbookadvanced.php
@@ -833,8 +833,11 @@ public function fixContinent() {
$this->load->model('logbookadvanced_model');
$result = $this->logbookadvanced_model->check_missing_continent();
- header("Content-Type: application/json");
- print json_encode($result);
+ $data['result'] = $result;
+
+ $data['type'] = 'continent';
+
+ $this->load->view('logbookadvanced/showUpdateResult', $data);
}
public function fixStateProgress() {
diff --git a/application/views/logbookadvanced/showUpdateResult.php b/application/views/logbookadvanced/showUpdateResult.php
index a52c5c87cd..55b247dd01 100644
--- a/application/views/logbookadvanced/showUpdateResult.php
+++ b/application/views/logbookadvanced/showUpdateResult.php
@@ -7,6 +7,9 @@
case 'state':
showStateUpdateResult($result, $country);
break;
+ case 'continent':
+ showContinentUpdateResult($result);
+ break;
default:
// Invalid type
break;
@@ -103,3 +106,11 @@ function showStateUpdateResult($result, $country) {
}
}
}
+
+function showContinentUpdateResult($result) {
+ if ($result == 0) {
+ echo '' . __("The number of QSOs updated for continent is") . ' : ' . $result . ' ';
+ } else {
+ echo '' . __("The number of QSOs updated for continent is") . ' : ' . $result . ' ';
+ }
+}
diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js
index a540567222..d90ff7dc42 100644
--- a/assets/js/sections/logbookadvanced.js
+++ b/assets/js/sections/logbookadvanced.js
@@ -2370,23 +2370,12 @@ function saveOptions() {
if (dialogItself != '') {
dialogItself.close();
}
- BootstrapDialog.alert({
- title: lang_gen_advanced_logbook_success,
- message: lang_gen_advanced_logbook_continents_updated + ' ' + response + ' ' + lang_gen_advanced_logbook_records_updated,
- type: BootstrapDialog.TYPE_SUCCESS
- });
+ $('.result').html(response);
$('#closeButton').prop("disabled", false);
},
- error: function () {
+ error: function(xhr, status, error) {
$('#updateContinentButton').prop("disabled", false).removeClass("running");
- if (dialogItself != '') {
- dialogItself.close();
- }
- BootstrapDialog.alert({
- title: lang_gen_advanced_logbook_error,
- message: lang_gen_advanced_logbook_problem_fixing_continents,
- type: BootstrapDialog.TYPE_DANGER
- });
+ $('.result').html(error);
$('#closeButton').prop("disabled", false);
}
});
From decc5f7d2c8033c7639a72308b4d88aa57576894 Mon Sep 17 00:00:00 2001
From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com>
Date: Mon, 15 Dec 2025 23:36:46 +0100
Subject: [PATCH 32/40] Fixed distance return result
---
application/controllers/Logbookadvanced.php | 7 +++++--
.../views/logbookadvanced/showUpdateResult.php | 11 +++++++++++
assets/js/sections/logbookadvanced.js | 14 +++-----------
3 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php
index a26716e68a..850a2bd26f 100644
--- a/application/controllers/Logbookadvanced.php
+++ b/application/controllers/Logbookadvanced.php
@@ -879,8 +879,11 @@ public function updateDistances() {
$this->load->model('logbookadvanced_model');
$result = $this->logbookadvanced_model->update_distances_batch();
- header("Content-Type: application/json");
- print json_encode($result);
+ $data['result'] = $result;
+
+ $data['type'] = 'distance';
+
+ $this->load->view('logbookadvanced/showUpdateResult', $data);
}
public function callbookDialog() {
diff --git a/application/views/logbookadvanced/showUpdateResult.php b/application/views/logbookadvanced/showUpdateResult.php
index 55b247dd01..2e052e8a07 100644
--- a/application/views/logbookadvanced/showUpdateResult.php
+++ b/application/views/logbookadvanced/showUpdateResult.php
@@ -10,6 +10,9 @@
case 'continent':
showContinentUpdateResult($result);
break;
+ case 'distance':
+ showDistanceUpdateResult($result);
+ break;
default:
// Invalid type
break;
@@ -114,3 +117,11 @@ function showContinentUpdateResult($result) {
echo '' . __("The number of QSOs updated for continent is") . ' : ' . $result . ' ';
}
}
+
+function showDistanceUpdateResult($result) {
+ if ($result == 0) {
+ echo '' . __("The number of QSOs updated for distance is") . ' : ' . $result . ' ';
+ } else {
+ echo '' . __("The number of QSOs updated for distance is") . ' : ' . $result . ' ';
+ }
+}
diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js
index d90ff7dc42..a0364d6bcf 100644
--- a/assets/js/sections/logbookadvanced.js
+++ b/assets/js/sections/logbookadvanced.js
@@ -2304,22 +2304,14 @@ function saveOptions() {
if (dialogItself != '') {
dialogItself.close();
}
- BootstrapDialog.alert({
- title: lang_gen_advanced_logbook_success,
- message: lang_gen_advanced_logbook_distances_updated + ' ' + response + ' ' + lang_gen_advanced_logbook_records_updated,
- type: BootstrapDialog.TYPE_SUCCESS
- });
+ $('.result').html(response);
},
- error: function () {
+ error: function(xhr, status, error) {
$('#updateDistanceButton').prop("disabled", false).removeClass("running");
if (dialogItself != '') {
dialogItself.close();
}
- BootstrapDialog.alert({
- title: lang_gen_advanced_logbook_error,
- message: lang_gen_advanced_logbook_problem_updating_distances,
- type: BootstrapDialog.TYPE_DANGER
- });
+ $('.result').html(error);
$('#closeButton').prop("disabled", false);
}
});
From 2456b183ee4a8552823d174728a1688e08b1b05e Mon Sep 17 00:00:00 2001
From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com>
Date: Tue, 16 Dec 2025 09:16:32 +0100
Subject: [PATCH 33/40] Fixed return for CQ and ITU zone
---
application/controllers/Logbookadvanced.php | 6 ++--
.../logbookadvanced/showUpdateResult.php | 22 +++++++++++++++
assets/js/sections/logbookadvanced.js | 28 ++++---------------
3 files changed, 32 insertions(+), 24 deletions(-)
diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php
index 850a2bd26f..f05f1b32b6 100644
--- a/application/controllers/Logbookadvanced.php
+++ b/application/controllers/Logbookadvanced.php
@@ -971,8 +971,10 @@ public function batchFix() {
$this->load->model('logbookadvanced_model');
$result = $this->logbookadvanced_model->batchFix($type);
- header("Content-Type: application/json");
- echo json_encode($result);
+ $data['result'] = $result;
+ $data['type'] = $type;
+
+ $this->load->view('logbookadvanced/showUpdateResult', $data);
}
}
diff --git a/application/views/logbookadvanced/showUpdateResult.php b/application/views/logbookadvanced/showUpdateResult.php
index 2e052e8a07..433ca94240 100644
--- a/application/views/logbookadvanced/showUpdateResult.php
+++ b/application/views/logbookadvanced/showUpdateResult.php
@@ -13,6 +13,12 @@
case 'distance':
showDistanceUpdateResult($result);
break;
+ case 'cqzones':
+ showCqzoneUpdateResult($result);
+ break;
+ case 'ituzones':
+ showItuzoneUpdateResult($result);
+ break;
default:
// Invalid type
break;
@@ -125,3 +131,19 @@ function showDistanceUpdateResult($result) {
echo '' . __("The number of QSOs updated for distance is") . ' : ' . $result . ' ';
}
}
+
+function showCqzoneUpdateResult($result) {
+ if ($result == 0) {
+ echo '' . __("The number of QSOs updated for CQ zone is") . ' : ' . $result . ' ';
+ } else {
+ echo '' . __("The number of QSOs updated for CQ zone is") . ' : ' . $result . ' ';
+ }
+}
+
+function showItuzoneUpdateResult($result) {
+ if ($result == 0) {
+ echo '' . __("The number of QSOs updated for ITU zone is") . ' : ' . $result . ' ';
+ } else {
+ echo '' . __("The number of QSOs updated for ITU zone is") . ' : ' . $result . ' ';
+ }
+}
diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js
index a0364d6bcf..8922043bd8 100644
--- a/assets/js/sections/logbookadvanced.js
+++ b/assets/js/sections/logbookadvanced.js
@@ -2385,20 +2385,12 @@ function saveOptions() {
success: function (response) {
$('#updateCqZonesBtn').prop("disabled", false).removeClass("running");
$('#closeButton').prop("disabled", false);
- BootstrapDialog.alert({
- title: lang_gen_advanced_logbook_success,
- message: lang_gen_advanced_logbook_cq_zones_updated + ' ' + response + ' ' + lang_gen_advanced_logbook_records_updated,
- type: BootstrapDialog.TYPE_SUCCESS
- });
+ $('.result').html(response);
},
- error: function () {
+ error: function(xhr, status, error) {
$('#updateCqZonesBtn').prop("disabled", false).removeClass("running");
$('#closeButton').prop("disabled", false);
- BootstrapDialog.alert({
- title: lang_gen_advanced_logbook_error,
- message: lang_gen_advanced_logbook_problem_fixing_cq_zones,
- type: BootstrapDialog.TYPE_DANGER
- });
+ $('.result').html(error);
}
});
}
@@ -2415,20 +2407,12 @@ function saveOptions() {
success: function (response) {
$('#updateItuZonesBtn').prop("disabled", false).removeClass("running");
$('#closeButton').prop("disabled", false);
- BootstrapDialog.alert({
- title: lang_gen_advanced_logbook_success,
- message: lang_gen_advanced_logbook_itu_zones_updated + ' ' + response + ' ' + lang_gen_advanced_logbook_records_updated,
- type: BootstrapDialog.TYPE_SUCCESS
- });
+ $('.result').html(response);
},
- error: function () {
+ error: function(xhr, status, error) {
$('#updateItuZonesBtn').prop("disabled", false).removeClass("running");
$('#closeButton').prop("disabled", false);
- BootstrapDialog.alert({
- title: lang_gen_advanced_logbook_error,
- message: lang_gen_advanced_logbook_problem_fixing_itu_zones,
- type: BootstrapDialog.TYPE_DANGER
- });
+ $('.result').html(error);
}
});
}
From 3688f7425e41a6791396242d13bdd319f873be60 Mon Sep 17 00:00:00 2001
From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com>
Date: Tue, 16 Dec 2025 09:53:34 +0100
Subject: [PATCH 34/40] Fix distance update count
---
application/models/Logbookadvanced_model.php | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php
index b4b1ad1120..039ef9ab18 100644
--- a/application/models/Logbookadvanced_model.php
+++ b/application/models/Logbookadvanced_model.php
@@ -1439,6 +1439,8 @@ public function update_distances_batch() {
$recordcount = $query->num_rows();
+ $count = 0;
+
if ($recordcount > 0) {
$this->load->library('Qra');
@@ -1451,10 +1453,14 @@ public function update_distances_batch() {
$row->COL_ANT_PATH ?? null
);
- $updates[] = [
- 'COL_PRIMARY_KEY' => $row->COL_PRIMARY_KEY,
- 'COL_DISTANCE' => $distance,
- ];
+ if ($distance != 0) {
+ $updates[] = [
+ 'COL_PRIMARY_KEY' => $row->COL_PRIMARY_KEY,
+ 'COL_DISTANCE' => $distance,
+ ];
+ $count++;
+ }
+
}
if (!empty($updates)) {
@@ -1462,7 +1468,7 @@ public function update_distances_batch() {
}
}
- return $recordcount;
+ return $count;
}
public function runCheckDb($type) {
From 0f1aa87beba7b78f22cf1a3ba955a674b1702d65 Mon Sep 17 00:00:00 2001
From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com>
Date: Tue, 16 Dec 2025 10:28:40 +0100
Subject: [PATCH 35/40] Rewrite query to plain sql
---
application/models/Logbookadvanced_model.php | 42 +++++++++-----------
1 file changed, 19 insertions(+), 23 deletions(-)
diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php
index 039ef9ab18..0223b130eb 100644
--- a/application/models/Logbookadvanced_model.php
+++ b/application/models/Logbookadvanced_model.php
@@ -1635,9 +1635,8 @@ function getStateListQsos($dxcc) {
}
/*
- This was moved from update to the advanced logbook. Maninly because it affected all QSOs in the logbook, with not filters on users or stations.
+ This was moved from update to the advanced logbook. Maninly because it affected all QSOs in the logbook, without filters on users or stations.
We need to ensure that we only update the relevant QSOs, filtered on user.
- The function needs a rewrite to add filtering on user/station.
*/
public function check_missing_dxcc_id($all = false) {
ini_set('memory_limit', '-1'); // This consumes a lot of Memory!
@@ -1713,20 +1712,24 @@ function batchFix($type) {
}
}
- public function check_missing_grid_id($all) {
+ /*
+ Another function moved from update to the advanced logbook, to be used in the dbtools section.
+ It did not have filter on user or location.
+ */
+ public function check_missing_grid_id() {
// get all records with no COL_GRIDSQUARE
- $this->db->select("COL_PRIMARY_KEY, COL_CALL, COL_TIME_ON, COL_TIME_OFF");
- $this->db->join('station_profile', 'station_profile.station_id = ' . $this->config->item('table_name') . '.station_id');
- $this->db->where("station_profile.user_id", $this->session->userdata('user_id'));
+ $sql = "select COL_PRIMARY_KEY, COL_CALL, COL_TIME_ON, COL_TIME_OFF from " . $this->config->item('table_name') .
+ " join station_profile on " . $this->config->item('table_name') . ".station_id = station_profile.station_id
+ where station_profile.user_id = ?
+ and (COL_GRIDSQUARE is NULL or COL_GRIDSQUARE = '')
+ AND (COL_VUCC_GRIDS is NULL or COL_VUCC_GRIDS = '')";
- $this->db->where("(COL_GRIDSQUARE is NULL or COL_GRIDSQUARE = '') AND (COL_VUCC_GRIDS is NULL or COL_VUCC_GRIDS = '')");
-
- $r = $this->db->get($this->config->item('table_name'));
+ $result = $this->db->query($sql, array($this->session->userdata('user_id')));
$count = 0;
$this->db->trans_start();
- if ($r->num_rows() > 0) {
- foreach ($r->result_array() as $row) {
+ if ($result->num_rows() > 0) {
+ foreach ($result->result_array() as $row) {
$callsign = $row['COL_CALL'];
if (!$this->load->is_loaded('callbook')) {
$this->load->library('callbook');
@@ -1736,18 +1739,11 @@ public function check_missing_grid_id($all) {
if (isset($callbook)) {
if (isset($callbook['error'])) {
- printf("Error: " . $callbook['error'] . ""); + $logerror = "Error: " . $callbook['error'] . " "; } else { - $return['callsign_qra'] = $callbook['gridsquare']; - if ($return['callsign_qra'] != '') { - $sql = sprintf( - "update %s set COL_GRIDSQUARE = '%s' where COL_PRIMARY_KEY=%d", - $this->config->item('table_name'), - $return['callsign_qra'], - $row['COL_PRIMARY_KEY'] - ); - $this->db->query($sql); - printf("Updating %s to %s\n ", $row['COL_PRIMARY_KEY'], $return['callsign_qra']); + if ($callbook['gridsquare'] != '') { + $sql = "update " . $this->config->item('table_name') . " set COL_GRIDSQUARE = ? where COL_PRIMARY_KEY = ?"; + $this->db->query($sql, array($callbook['gridsquare'], $row['COL_PRIMARY_KEY'])); $count++; } } @@ -1756,6 +1752,6 @@ public function check_missing_grid_id($all) { } $this->db->trans_complete(); - print("$count updated\n"); + return $count . ' updated'; } } From 6985604463b13b868700c8e05d4359c7f1b74bfb Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Tue, 16 Dec 2025 11:47:50 +0100 Subject: [PATCH 36/40] Added location and callsign link --- application/models/Logbookadvanced_model.php | 6 ++++-- application/views/logbookadvanced/showUpdateResult.php | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php index 0223b130eb..a48d367faf 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -1584,7 +1584,7 @@ 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 + $sql = "SELECT COL_PRIMARY_KEY, COL_CALL, COL_GRIDSQUARE, COL_DXCC, COL_STATE, d.name as dxcc_name, station_profile.station_profile_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 @@ -1611,7 +1611,9 @@ function fixStateBatch($dxcc) { if ($result['success']) { $count++; } else { - $results []= $result; + $result['station_profile_name'] = $qso->station_profile_name; + $result['id'] = $qso->COL_PRIMARY_KEY; + $results[] = $result; } } diff --git a/application/views/logbookadvanced/showUpdateResult.php b/application/views/logbookadvanced/showUpdateResult.php index 433ca94240..6391359914 100644 --- a/application/views/logbookadvanced/showUpdateResult.php +++ b/application/views/logbookadvanced/showUpdateResult.php @@ -98,14 +98,16 @@ function showStateUpdateResult($result, $country) { echo ' Callsign | ';
echo 'Reason | ';
+ echo 'Station location | ';
echo '' . htmlspecialchars($r['callsign']) . ' | ';
+ echo '' . htmlspecialchars($r['callsign']) . ' | ';
echo '' . htmlspecialchars($r['reason']) . ' | ';
+ echo '' . htmlspecialchars($r['station_profile_name']) . ' | ';
echo '' . htmlspecialchars($r['callsign']) . ' | ';
+ echo '' . htmlspecialchars($r['callsign']) . ' | ';
echo '' . htmlspecialchars($r['reason']) . ' | ';
echo '' . htmlspecialchars($r['location']) . ' | ';
echo '- Found QSO(s) missing DXCC information. +
|
|---|