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 @@ +
+
+
+
+
+
+
+
+

+
+
+ + +
+
+ +
+
+
+

+
+
+ + +
+
+ +
+
+
+

+
+
+ + +
+
+ +
+
+
+

+
+
+ + +
+
+ +
+
+
+

+
+
+ + +
+
+ +
+
+
+

+
+
+ + +
+
+ +
+
+
+

+
+
+ + +
+
+ +
+
+
+ + +
+
diff --git a/application/views/logbookadvanced/index.php b/application/views/logbookadvanced/index.php index 3d636282be..51710bd4a5 100644 --- a/application/views/logbookadvanced/index.php +++ b/application/views/logbookadvanced/index.php @@ -771,6 +771,7 @@ + diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js index be429fae70..526f8239a5 100644 --- a/assets/js/sections/logbookadvanced.js +++ b/assets/js/sections/logbookadvanced.js @@ -1335,6 +1335,31 @@ $(document).ready(function () { }); }); + $('#dbtools').click(function (event) { + $.ajax({ + url: base_url + 'index.php/logbookadvanced/dbtoolsDialog', + type: 'post', + success: function (html) { + BootstrapDialog.show({ + title: 'Database tools', + size: BootstrapDialog.SIZE_WIDE, + cssClass: 'options', + nl2br: false, + message: html, + buttons: [ + { + label: lang_admin_close, + cssClass: 'btn btn-sm btn-secondary', + id: 'closeButton', + action: function (dialogItself) { + dialogItself.close(); + } + }], + }); + } + }); + }); + function runUpdateDistancesFix(dialogItself) { $('#updateDistanceButton').prop("disabled", true).addClass("running"); $('#closeButton').prop("disabled", true); @@ -2002,3 +2027,43 @@ function saveOptions() { dateFrom.value = ''; dateTo.value = ''; } + + function checkUpdateDistances() { + $('#checkUpdateDistancesBtn').prop("disabled", true).addClass("running"); + $('#closeButton').prop("disabled", true); + + + $.ajax({ + url: base_url + 'index.php/logbookadvanced/checkDb', + data: { + type: 'distance' + }, + type: 'POST', + success: function(response) { + $('#checkUpdateDistancesBtn').prop("disabled", false).removeClass("running"); + $('#closeButton').prop("disabled", false); + // Create a nice display for the results + let resultHtml = '
Distance Check Results
'; + resultHtml += '

QSO to update found: ' + (response[0].count) + '

'; + + $('.result').html(resultHtml); + }, + error: function(xhr, status, error) { + $('#checkUpdateDistancesBtn').prop('disabled', false).text(''); + $('#closeButton').prop('disabled', false); + + let errorMsg = ''; + if (xhr.responseJSON && xhr.responseJSON.message) { + errorMsg += ': ' + xhr.responseJSON.message; + } + + BootstrapDialog.alert({ + title: '', + 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 @@

- -
@@ -24,11 +24,11 @@

- -
@@ -39,11 +39,11 @@

- -
@@ -54,11 +54,11 @@

- -
@@ -69,11 +69,11 @@

- -
@@ -84,11 +84,11 @@

- -
@@ -96,14 +96,12 @@
-

+

+

- -
diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js index 526f8239a5..759c993cc0 100644 --- a/assets/js/sections/logbookadvanced.js +++ b/assets/js/sections/logbookadvanced.js @@ -2034,36 +2034,109 @@ function saveOptions() { $.ajax({ - url: base_url + 'index.php/logbookadvanced/checkDb', - data: { - type: 'distance' - }, - type: 'POST', - success: function(response) { - $('#checkUpdateDistancesBtn').prop("disabled", false).removeClass("running"); - $('#closeButton').prop("disabled", false); - // Create a nice display for the results - let resultHtml = '
Distance Check Results
'; - resultHtml += '

QSO to update found: ' + (response[0].count) + '

'; - - $('.result').html(resultHtml); - }, - error: function(xhr, status, error) { - $('#checkUpdateDistancesBtn').prop('disabled', false).text(''); - $('#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 = '
Distance Check Results
'; + resultHtml += '

QSO to update found: ' + (response[0].count) + '

'; - let errorMsg = ''; - if (xhr.responseJSON && xhr.responseJSON.message) { - errorMsg += ': ' + xhr.responseJSON.message; + $('.result').html(resultHtml); + }, + error: function(xhr, status, error) { + $('#checkUpdateDistancesBtn').prop('disabled', false).text(''); + $('#closeButton').prop('disabled', false); + + let errorMsg = ''; + if (xhr.responseJSON && xhr.responseJSON.message) { + errorMsg += ': ' + xhr.responseJSON.message; + } + + BootstrapDialog.alert({ + title: '', + message: errorMsg, + type: BootstrapDialog.TYPE_DANGER + }); } + }); + } - BootstrapDialog.alert({ - title: '', - 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 = '
DXCC Check Results
'; + resultHtml += '

QSOs without DXCC information found: ' + (response[0].count) + '

'; + + $('.result').html(resultHtml); + }, + error: function(xhr, status, error) { + $('#checkMissingDxccsBtn').prop('disabled', false).text(''); + $('#closeButton').prop('disabled', false); + + let errorMsg = ''; + if (xhr.responseJSON && xhr.responseJSON.message) { + errorMsg += ': ' + xhr.responseJSON.message; + } + + BootstrapDialog.alert({ + title: '', + 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 = '
Continent Check Results
'; + 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(''); + $('#closeButton').prop('disabled', false); + + let errorMsg = ''; + if (xhr.responseJSON && xhr.responseJSON.message) { + errorMsg += ': ' + xhr.responseJSON.message; + } + + BootstrapDialog.alert({ + title: '', + 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): ?> +
+
State Check Results
+

QSOs with missing state and gridsquares with 6 or more characters found for the following DXCC's:

+ +
+ + + + + + + + + + $item): ?> + dxcc_name) ? $item->dxcc_name : ''; + $formattedName = ucwords(strtolower($rawName), "- (/"); + $name = htmlspecialchars($formattedName, ENT_QUOTES, 'UTF-8'); + $qsos = isset($item->count) ? intval($item->count) : 0; + ?> + + + + + + + +
PrefixDXCCQSOs
prefix; ?>
+
+
+ +
+
State Check Results
+

No issues found. All QSOs have proper state information.

+
+ diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js index 759c993cc0..2b9f2d161b 100644 --- a/assets/js/sections/logbookadvanced.js +++ b/assets/js/sections/logbookadvanced.js @@ -2119,7 +2119,7 @@ function saveOptions() { $('#closeButton').prop("disabled", false); // Create a nice display for the results let resultHtml = '
Continent Check Results
'; - resultHtml += '

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(''); + $('#closeButton').prop('disabled', false); + + let errorMsg = ''; + if (xhr.responseJSON && xhr.responseJSON.message) { + errorMsg += ': ' + xhr.responseJSON.message; + } + + BootstrapDialog.alert({ + title: '', + 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 = '
State Check Results
'; + 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(''); + $('#closeButton').prop('disabled', false); + + let errorMsg = ''; + if (xhr.responseJSON && xhr.responseJSON.message) { + errorMsg += ': ' + xhr.responseJSON.message; + } + + BootstrapDialog.alert({ + title: '', + 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): ?>
-
State Check Results
-

QSOs with missing state and gridsquares with 6 or more characters found for the following DXCC's:

+
+

-
+
- - - + + + + @@ -24,6 +25,11 @@ + @@ -32,7 +38,7 @@
-
State Check Results
-

No issues found. All QSOs have proper state information.

+
+

diff --git a/application/views/logbookadvanced/dbtoolsdialog.php b/application/views/logbookadvanced/dbtoolsdialog.php index bca0ea9d05..69c7398d99 100644 --- a/application/views/logbookadvanced/dbtoolsdialog.php +++ b/application/views/logbookadvanced/dbtoolsdialog.php @@ -1,7 +1,11 @@
-
+
+ +
@@ -12,9 +16,6 @@ -
@@ -27,9 +28,6 @@ -
@@ -42,9 +40,6 @@ -
@@ -57,9 +52,6 @@ - @@ -72,9 +64,6 @@ - @@ -87,9 +76,6 @@ - diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js index 2b9f2d161b..c6c38f4d84 100644 --- a/assets/js/sections/logbookadvanced.js +++ b/assets/js/sections/logbookadvanced.js @@ -2044,7 +2044,7 @@ function saveOptions() { $('#closeButton').prop("disabled", false); // Create a nice display for the results let resultHtml = '
Distance Check Results
'; - resultHtml += '

QSO to update found: ' + (response[0].count) + '

'; + resultHtml += '

QSO to update found: ' + (response[0].count) + '

'; $('.result').html(resultHtml); }, @@ -2082,7 +2082,7 @@ function saveOptions() { $('#closeButton').prop("disabled", false); // Create a nice display for the results let resultHtml = '
DXCC Check Results
'; - resultHtml += '

QSOs without DXCC information found: ' + (response[0].count) + '

'; + resultHtml += '

QSOs without DXCC information found: ' + (response[0].count) + '

'; $('.result').html(resultHtml); }, @@ -2119,7 +2119,7 @@ function saveOptions() { $('#closeButton').prop("disabled", false); // Create a nice display for the results let resultHtml = '
Continent Check Results
'; - resultHtml += '

QSOs with missing or invalid continent information found: ' + (response[0].count) + '

'; + resultHtml += '

QSOs with missing or invalid continent information found: ' + (response[0].count) + '

'; $('.result').html(resultHtml); }, @@ -2175,27 +2175,27 @@ function saveOptions() { }); } - function checkFixState2() { - $('#checkFixStateBtn').prop("disabled", true).addClass("running"); + function checkFixCqZones() { + $('#checkFixCqZonesBtn').prop("disabled", true).addClass("running"); $('#closeButton').prop("disabled", true); $.ajax({ url: base_url + 'index.php/logbookadvanced/checkDb', data: { - type: 'checkstate' + type: 'checkcqzones' }, type: 'POST', success: function(response) { - $('#checkFixStateBtn').prop("disabled", false).removeClass("running"); + $('#checkFixCqZonesBtn').prop("disabled", false).removeClass("running"); $('#closeButton').prop("disabled", false); // Create a nice display for the results - let resultHtml = '
State Check Results
'; - resultHtml += '

QSOs with missing state and gridsquares with 6 or more characters found: ' + (response[0].count) + '

'; + let resultHtml = '
CQ Zone Check Results
'; + resultHtml += '

QSOs with missing CQ zone information found: ' + (response[0].count) + '

'; $('.result').html(resultHtml); }, error: function(xhr, status, error) { - $('#checkFixStateBtn').prop('disabled', false).text(''); + $('#checkFixCqZonesBtn').prop('disabled', false).text(''); $('#closeButton').prop('disabled', false); let errorMsg = ''; @@ -2211,3 +2211,61 @@ function saveOptions() { } }); } + + function checkFixItuZones() { + $('#checkFixItuZonesBtn').prop("disabled", true).addClass("running"); + $('#closeButton').prop("disabled", true); + + $.ajax({ + url: base_url + 'index.php/logbookadvanced/checkDb', + data: { + type: 'checkituzones' + }, + type: 'POST', + success: function(response) { + $('#checkFixItuZonesBtn').prop("disabled", false).removeClass("running"); + $('#closeButton').prop("disabled", false); + // Create a nice display for the results + let resultHtml = '
ITU Zone Check Results
'; + resultHtml += '

QSOs with missing ITU zone information found: ' + (response[0].count) + '

'; + + $('.result').html(resultHtml); + }, + error: function(xhr, status, error) { + $('#checkFixItuZonesBtn').prop('disabled', false).text(''); + $('#closeButton').prop('disabled', false); + + let errorMsg = ''; + if (xhr.responseJSON && xhr.responseJSON.message) { + errorMsg += ': ' + xhr.responseJSON.message; + } + + BootstrapDialog.alert({ + title: '', + message: errorMsg, + type: BootstrapDialog.TYPE_DANGER + }); + } + }); + } + + function fixState(dxcc) { + $('#fixStateButton').prop("disabled", true).addClass("running"); + + $.ajax({ + url: base_url + 'index.php/logbookadvanced/fixStateBatch', + type: 'post', + data: { + 'dxcc': dxcc + }, + success: function (response) { + $('#fixStateButton').prop("disabled", false).removeClass("running"); + }, + error: function () { + $('#fixStateButton').prop("disabled", false).removeClass("running"); + } + }); + } + + + From 46fad667bcf035e589b02a0866bae1b6faab227f Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Sun, 7 Dec 2025 22:38:51 +0100 Subject: [PATCH 05/40] Added button to show qso list in state --- application/controllers/Logbookadvanced.php | 14 +++++++ application/models/Logbookadvanced_model.php | 13 +++++++ .../views/logbookadvanced/checkresult.php | 3 +- .../views/logbookadvanced/showStateQsos.php | 38 +++++++++++++++++++ assets/js/sections/logbookadvanced.js | 29 ++++++++++++-- 5 files changed, 92 insertions(+), 5 deletions(-) create mode 100644 application/views/logbookadvanced/showStateQsos.php diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php index 4a6d417b26..1b781c3e85 100644 --- a/application/controllers/Logbookadvanced.php +++ b/application/controllers/Logbookadvanced.php @@ -920,4 +920,18 @@ public function fixStateBatch() { header("Content-Type: application/json"); echo json_encode($result); } + + public function openStateList() { + if(!clubaccess_check(9)) return; + + $this->load->model('logbook_model'); + $this->load->model('logbookadvanced_model'); + + $data['dxcc'] = $this->input->post('dxcc', true); + + // Process for batch QSO state fix + $data['qsos'] = $this->logbookadvanced_model->getStateListQsos($data['dxcc']); + + $this->load->view('logbookadvanced/showStateQsos', $data); + } } diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php index 3dfe433bfe..af5781d44a 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -1578,4 +1578,17 @@ function fixStateBatch($dxcc) { return $results; } + + function getStateListQsos($dxcc) { + $sql = "SELECT col_call, col_time_on, col_mode, col_submode, col_band, col_state, col_gridsquare FROM " . $this->config->item('table_name') . " qsos + JOIN station_profile ON qsos.station_id = station_profile.station_id + 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 + ORDER BY COL_TIME_ON DESC"; + + $query = $this->db->query($sql, [$dxcc, $this->session->userdata('user_id')]); + + return $query->result(); + } } diff --git a/application/views/logbookadvanced/checkresult.php b/application/views/logbookadvanced/checkresult.php index 10dc34aa11..512bcfb4f9 100644 --- a/application/views/logbookadvanced/checkresult.php +++ b/application/views/logbookadvanced/checkresult.php @@ -26,9 +26,10 @@ 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 @@ +

QSOs Missing State Information

+ 0): ?> +
PrefixDXCCQSOs
prefix; ?> + +
- +
+ + + + + + + + + + + + + + + + + + + + + + + + +
CallDate/TimeModeSubmodeBandStateGridsquare
col_call; ?>col_time_on)); ?>col_mode; ?>col_submode ?? ''; ?>col_band; ?>col_state; ?>col_gridsquare; ?>
+
+

+ Found QSO(s) missing state information for DXCC . +

+
+ +
+

No Issues Found

+
+ diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js index c6c38f4d84..7420131d28 100644 --- a/assets/js/sections/logbookadvanced.js +++ b/assets/js/sections/logbookadvanced.js @@ -2250,7 +2250,7 @@ function saveOptions() { } function fixState(dxcc) { - $('#fixStateButton').prop("disabled", true).addClass("running"); + $('#fixStateBtn_' + dxcc).prop("disabled", true).addClass("running"); $.ajax({ url: base_url + 'index.php/logbookadvanced/fixStateBatch', @@ -2259,13 +2259,34 @@ function saveOptions() { 'dxcc': dxcc }, success: function (response) { - $('#fixStateButton').prop("disabled", false).removeClass("running"); + $('#fixStateBtn_' + dxcc).prop("disabled", false).removeClass("running"); }, error: function () { - $('#fixStateButton').prop("disabled", false).removeClass("running"); + $('#fixStateBtn_' + dxcc).prop("disabled", false).removeClass("running"); } }); } + function openStateList(dxcc) { + $('#openStateListBtn_' + dxcc).prop("disabled", true).addClass("running"); - + $.ajax({ + url: base_url + 'index.php/logbookadvanced/OpenStateList', + type: 'post', + data: { + 'dxcc': dxcc + }, + success: function (response) { + $('#openStateListBtn_' + dxcc).prop("disabled", false).removeClass("running"); + BootstrapDialog.show({ + title: 'QSO List', + message: response, + size: BootstrapDialog.SIZE_WIDE, + type: BootstrapDialog.TYPE_INFO + }); + }, + error: function () { + $('#openStateListBtn_' + dxcc).prop("disabled", false).removeClass("running"); + } + }); + } From 10c5a0a545375f69962c7c6339edbd51ff069f71 Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Mon, 8 Dec 2025 10:58:26 +0100 Subject: [PATCH 06/40] Fix QSO list. Added info to info button --- application/controllers/Logbookadvanced.php | 4 + application/libraries/Geojson.php | 80 ++++----- application/models/Logbookadvanced_model.php | 3 +- .../views/logbookadvanced/dbtoolsdialog.php | 4 +- .../logbookadvanced/dbtoolsinformation.php | 170 ++++++++++++++++++ .../views/logbookadvanced/showStateQsos.php | 21 +-- assets/js/sections/logbookadvanced.js | 30 +++- 7 files changed, 257 insertions(+), 55 deletions(-) create mode 100644 application/views/logbookadvanced/dbtoolsinformation.php diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php index 1b781c3e85..d9fa9052a0 100644 --- a/application/controllers/Logbookadvanced.php +++ b/application/controllers/Logbookadvanced.php @@ -889,6 +889,10 @@ public function dbtoolsDialog() { $this->load->view('logbookadvanced/dbtoolsdialog'); } + public function dbtoolsInfo() { + $this->load->view('logbookadvanced/dbtoolsinformation'); + } + public function checkDb() { if(!clubaccess_check(9)) return; diff --git a/application/libraries/Geojson.php b/application/libraries/Geojson.php index c832fcbe56..814beaaafc 100644 --- a/application/libraries/Geojson.php +++ b/application/libraries/Geojson.php @@ -22,47 +22,47 @@ class Geojson { * Value: Array with 'name' and 'enabled' flag */ const SUPPORTED_STATES = [ - 1 => ['name' => 'Canada', 'enabled' => true], // 13 provinces/territories - 6 => ['name' => 'Alaska', 'enabled' => true], // 1 state - 27 => ['name' => 'Belarus', 'enabled' => true], // 7 subdivisions - 29 => ['name' => 'Canary Islands', 'enabled' => true], // 2 provinces - 32 => ['name' => 'Ceuta & Melilla', 'enabled' => true], // 2 autonomous cities - 50 => ['name' => 'Mexico', 'enabled' => true], // 32 states - 100 => ['name' => 'Argentina', 'enabled' => true], // 24 subdivisions - 108 => ['name' => 'Brazil', 'enabled' => true], // 27 subdivisions - 112 => ['name' => 'Chile', 'enabled' => true], // 16 regions + 1 => ['name' => 'Canada', 'enabled' => true], // 13 provinces/territories + 6 => ['name' => 'Alaska', 'enabled' => true], // 1 state + 27 => ['name' => 'Belarus', 'enabled' => true], // 7 subdivisions + 29 => ['name' => 'Canary Islands', 'enabled' => true], // 2 provinces + 32 => ['name' => 'Ceuta & Melilla', 'enabled' => true], // 2 autonomous cities + 50 => ['name' => 'Mexico', 'enabled' => true], // 32 states + 100 => ['name' => 'Argentina', 'enabled' => true], // 24 subdivisions + 108 => ['name' => 'Brazil', 'enabled' => true], // 27 subdivisions + 110 => ['name' => 'Hawaii', 'enabled' => true], // 1 state + 112 => ['name' => 'Chile', 'enabled' => true], // 16 regions 137 => ['name' => 'Republic of Korea', 'enabled' => true], // 17 subdivisions - 110 => ['name' => 'Hawaii', 'enabled' => true], // 1 state - 144 => ['name' => 'Uruguay', 'enabled' => true], // 19 subdivisions - 148 => ['name' => 'Venezuela', 'enabled' => true], // 24 states - 149 => ['name' => 'Azores', 'enabled' => true], // 1 autonomous region - 150 => ['name' => 'Australia', 'enabled' => true], // 8 subdivisions - 163 => ['name' => 'Papua New Guinea', 'enabled' => true], // 22 provinces - 170 => ['name' => 'New Zealand', 'enabled' => true], // 16 regions - 209 => ['name' => 'Belgium', 'enabled' => true], // 11 subdivisions - 212 => ['name' => 'Bulgaria', 'enabled' => true], // 28 subdivisions - 214 => ['name' => 'Corsica', 'enabled' => true], // 2 departments (2A, 2B) - 225 => ['name' => 'Sardinia', 'enabled' => true], // 5 provinces - 227 => ['name' => 'France', 'enabled' => true], // 96 departments - 230 => ['name' => 'Germany', 'enabled' => true], // 16 federal states - 239 => ['name' => 'Hungary', 'enabled' => true], // 20 subdivisions - 245 => ['name' => 'Ireland', 'enabled' => true], // 27 subdivisions - 248 => ['name' => 'Italy', 'enabled' => true], // 107 provinces - 256 => ['name' => 'Madeira Islands', 'enabled' => true], // 1 autonomous region - 263 => ['name' => 'Netherlands', 'enabled' => true], // 12 provinces - 266 => ['name' => 'Norway', 'enabled' => true], // 11 counties - 269 => ['name' => 'Poland', 'enabled' => true], // 16 voivodeships - 272 => ['name' => 'Portugal', 'enabled' => true], // 18 districts - 275 => ['name' => 'Romania', 'enabled' => true], // 42 counties - 281 => ['name' => 'Spain', 'enabled' => true], // 47 provinces - 284 => ['name' => 'Sweden', 'enabled' => true], // 21 subdivisions - 287 => ['name' => 'Switzerland', 'enabled' => true], // 26 cantons - 291 => ['name' => 'USA', 'enabled' => true], // 52 states/territories - 318 => ['name' => 'China', 'enabled' => true], // 31 provinces - 324 => ['name' => 'India', 'enabled' => true], // 36 states/territories - 339 => ['name' => 'Japan', 'enabled' => true], // 47 prefectures - 386 => ['name' => 'Taiwan', 'enabled' => true], // 22 subdivisions - 497 => ['name' => 'Croatia', 'enabled' => true], // 21 subdivisions + 144 => ['name' => 'Uruguay', 'enabled' => true], // 19 subdivisions + 148 => ['name' => 'Venezuela', 'enabled' => true], // 24 states + 149 => ['name' => 'Azores', 'enabled' => true], // 1 autonomous region + 150 => ['name' => 'Australia', 'enabled' => true], // 8 subdivisions + 163 => ['name' => 'Papua New Guinea', 'enabled' => true], // 22 provinces + 170 => ['name' => 'New Zealand', 'enabled' => true], // 16 regions + 209 => ['name' => 'Belgium', 'enabled' => true], // 11 subdivisions + 212 => ['name' => 'Bulgaria', 'enabled' => true], // 28 subdivisions + 214 => ['name' => 'Corsica', 'enabled' => true], // 2 departments (2A, 2B) + 225 => ['name' => 'Sardinia', 'enabled' => true], // 5 provinces + 227 => ['name' => 'France', 'enabled' => true], // 96 departments + 230 => ['name' => 'Germany', 'enabled' => true], // 16 federal states + 239 => ['name' => 'Hungary', 'enabled' => true], // 20 subdivisions + 245 => ['name' => 'Ireland', 'enabled' => true], // 27 subdivisions + 248 => ['name' => 'Italy', 'enabled' => true], // 107 provinces + 256 => ['name' => 'Madeira Islands', 'enabled' => true], // 1 autonomous region + 263 => ['name' => 'Netherlands', 'enabled' => true], // 12 provinces + 266 => ['name' => 'Norway', 'enabled' => true], // 11 counties + 269 => ['name' => 'Poland', 'enabled' => true], // 16 voivodeships + 272 => ['name' => 'Portugal', 'enabled' => true], // 18 districts + 275 => ['name' => 'Romania', 'enabled' => true], // 42 counties + 281 => ['name' => 'Spain', 'enabled' => true], // 47 provinces + 284 => ['name' => 'Sweden', 'enabled' => true], // 21 subdivisions + 287 => ['name' => 'Switzerland', 'enabled' => true], // 26 cantons + 291 => ['name' => 'USA', 'enabled' => true], // 52 states/territories + 318 => ['name' => 'China', 'enabled' => true], // 31 provinces + 324 => ['name' => 'India', 'enabled' => true], // 36 states/territories + 339 => ['name' => 'Japan', 'enabled' => true], // 47 prefectures + 386 => ['name' => 'Taiwan', 'enabled' => true], // 22 subdivisions + 497 => ['name' => 'Croatia', 'enabled' => true], // 21 subdivisions ]; private $qra; diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php index af5781d44a..f069bce581 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -1580,8 +1580,9 @@ function fixStateBatch($dxcc) { } function getStateListQsos($dxcc) { - $sql = "SELECT col_call, col_time_on, col_mode, col_submode, col_band, col_state, col_gridsquare FROM " . $this->config->item('table_name') . " qsos + $sql = "SELECT col_call, col_time_on, col_mode, col_submode, col_band, col_state, col_gridsquare, 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 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 diff --git a/application/views/logbookadvanced/dbtoolsdialog.php b/application/views/logbookadvanced/dbtoolsdialog.php index 69c7398d99..5f1245a8c4 100644 --- a/application/views/logbookadvanced/dbtoolsdialog.php +++ b/application/views/logbookadvanced/dbtoolsdialog.php @@ -2,7 +2,7 @@
-
@@ -83,7 +83,7 @@

-

+

- -
-
-
-

- -

: -

-
- - - -
From bde29d6cbf030846597e0df8d0c46d9e2685cad5 Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Mon, 8 Dec 2025 11:53:27 +0100 Subject: [PATCH 08/40] Add userid filter --- 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 27a3ac7839..7ece14b11c 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -1602,6 +1602,8 @@ public function check_missing_dxcc_id($all) { ini_set('memory_limit', '-1'); // This consumes a lot of Memory! $this->db->trans_start(); // Transaction has to be started here, because otherwise we're trying to update rows which are locked by the select $this->db->select("COL_PRIMARY_KEY, COL_CALL, COL_TIME_ON, COL_TIME_OFF"); // get all records with no COL_DXCC + $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')); if (!$all) { // check which to update - records with no dxcc or all records $this->db->where("COL_DXCC is NULL"); @@ -1612,7 +1614,7 @@ public function check_missing_dxcc_id($all) { $count = 0; if ($r->num_rows() > 0) { //query dxcc_prefixes - $sql = "update " . $this->config->item('table_name') . " set COL_COUNTRY = ?, COL_DXCC=? where COL_PRIMARY_KEY=?"; + $sql = "update " . $this->config->item('table_name') . " set COL_COUNTRY = ?, COL_DXCC = ? where COL_PRIMARY_KEY = ?"; $q = $this->db->conn_id->prepare($sql); // PREPARE this statement. For DB this means: No parsing overhead, parse once use many (see execute query below) foreach ($r->result_array() as $row) { $qso_date = $row['COL_TIME_OFF'] == '' ? $row['COL_TIME_ON'] : $row['COL_TIME_OFF']; From 7e3b9620194703e11d4a1a87d56b47b175b69728 Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Mon, 8 Dec 2025 14:59:43 +0100 Subject: [PATCH 09/40] Get dxcc fix working in gui --- application/controllers/Logbookadvanced.php | 12 +++++++++++- application/models/Logbookadvanced_model.php | 7 +++++-- .../views/logbookadvanced/dbtoolsdialog.php | 2 +- assets/js/sections/logbookadvanced.js | 16 ++++++++++++++++ 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php index d9fa9052a0..a325537691 100644 --- a/application/controllers/Logbookadvanced.php +++ b/application/controllers/Logbookadvanced.php @@ -928,7 +928,6 @@ public function fixStateBatch() { public function openStateList() { if(!clubaccess_check(9)) return; - $this->load->model('logbook_model'); $this->load->model('logbookadvanced_model'); $data['dxcc'] = $this->input->post('dxcc', true); @@ -938,4 +937,15 @@ public function openStateList() { $this->load->view('logbookadvanced/showStateQsos', $data); } + + public function fixMissingDxcc() { + if(!clubaccess_check(9)) return; + + $all = $this->input->post('all', true); + $this->load->model('logbookadvanced_model'); + $result = $this->logbookadvanced_model->check_missing_dxcc_id($all); + + header("Content-Type: application/json"); + echo json_encode($result); + } } diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php index 7ece14b11c..928e4e21aa 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -1598,7 +1598,7 @@ function getStateListQsos($dxcc) { 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) { + public function check_missing_dxcc_id($all = false) { ini_set('memory_limit', '-1'); // This consumes a lot of Memory! $this->db->trans_start(); // Transaction has to be started here, because otherwise we're trying to update rows which are locked by the select $this->db->select("COL_PRIMARY_KEY, COL_CALL, COL_TIME_ON, COL_TIME_OFF"); // get all records with no COL_DXCC @@ -1606,7 +1606,10 @@ public function check_missing_dxcc_id($all) { $this->db->where("station_profile.user_id", $this->session->userdata('user_id')); if (!$all) { // check which to update - records with no dxcc or all records + $this->db->group_start(); $this->db->where("COL_DXCC is NULL"); + $this->db->or_where("COL_DXCC = ''"); + $this->db->group_end(); } $r = $this->db->get($this->config->item('table_name')); @@ -1627,6 +1630,6 @@ public function check_missing_dxcc_id($all) { } } $this->db->trans_complete(); - print("$count updated\n"); + return $count; } } diff --git a/application/views/logbookadvanced/dbtoolsdialog.php b/application/views/logbookadvanced/dbtoolsdialog.php index 5f1245a8c4..3de1e644fc 100644 --- a/application/views/logbookadvanced/dbtoolsdialog.php +++ b/application/views/logbookadvanced/dbtoolsdialog.php @@ -86,7 +86,7 @@

-
diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js index 95528e5f93..89632ee814 100644 --- a/assets/js/sections/logbookadvanced.js +++ b/assets/js/sections/logbookadvanced.js @@ -2316,3 +2316,19 @@ function saveOptions() { }); } + + function fixMissingDxcc() { + $.ajax({ + url: base_url + 'index.php/logbookadvanced/fixMissingDxcc', + data: { + all: 'false' + }, + type: 'POST', + success: function(response) { + alert('dxcc'); + }, + error: function(xhr, status, error) { + alert('error'); + } + }); + } From 462664f7bf841778852672e5b773faa8cdb24025 Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Mon, 8 Dec 2025 16:23:53 +0100 Subject: [PATCH 10/40] Use html view to load result instead --- application/controllers/Logbookadvanced.php | 9 +- .../views/logbookadvanced/checkresult.php | 89 ++++++++++--------- .../logbookadvanced/statecheckresult.php | 45 ++++++++++ assets/js/sections/logbookadvanced.js | 53 ++++------- 4 files changed, 110 insertions(+), 86 deletions(-) create mode 100644 application/views/logbookadvanced/statecheckresult.php diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php index a325537691..88d748a8ee 100644 --- a/application/controllers/Logbookadvanced.php +++ b/application/controllers/Logbookadvanced.php @@ -899,13 +899,12 @@ public function checkDb() { $type = $this->input->post('type', true); $this->load->model('logbookadvanced_model'); + $data['result'] = $this->logbookadvanced_model->runCheckDb($type); if ($type == 'checkstate') { - $data['result'] = $this->logbookadvanced_model->runCheckDb($type); - $this->load->view('logbookadvanced/checkresult', $data); + $this->load->view('logbookadvanced/statecheckresult', $data); } else { - $result = $this->logbookadvanced_model->runCheckDb($type); - header("Content-Type: application/json"); - echo json_encode($result); + $data['type'] = $type; + $this->load->view('logbookadvanced/checkresult', $data); } } diff --git a/application/views/logbookadvanced/checkresult.php b/application/views/logbookadvanced/checkresult.php index 512bcfb4f9..f105fe2ddf 100644 --- a/application/views/logbookadvanced/checkresult.php +++ b/application/views/logbookadvanced/checkresult.php @@ -1,45 +1,46 @@ - 0): ?> -
-
-

+ - - - - - - - - - - - $item): ?> - dxcc_name) ? $item->dxcc_name : ''; - $formattedName = ucwords(strtolower($rawName), "- (/"); - $name = htmlspecialchars($formattedName, ENT_QUOTES, 'UTF-8'); - $qsos = isset($item->count) ? intval($item->count) : 0; - ?> - - - - - - - - -
prefix; ?> - - -
-
-
- -
-
-

-
- +function check_missing_distance($result) { ?> +
Distance Check Results
+ QSOs to update found: count; ?> + +
Continent Check Results
+ QSOs to update found: count; ?> + +
DXCC Check Results
+ QSOs to update found: count; ?> + +
CQ Zone Check Results
+ QSOs to update found: count; ?> + +
ITU Zone Check Results
+ QSOs to update found: count; ?> + 0): ?> +
+
+

+ +
+ + + + + + + + + + + $item): ?> + dxcc_name) ? $item->dxcc_name : ''; + $formattedName = ucwords(strtolower($rawName), "- (/"); + $name = htmlspecialchars($formattedName, ENT_QUOTES, 'UTF-8'); + $qsos = isset($item->count) ? intval($item->count) : 0; + ?> + + + + + + + + +
prefix; ?> + + +
+
+
+ +
+
+

+
+ diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js index 89632ee814..f83c8c29de 100644 --- a/assets/js/sections/logbookadvanced.js +++ b/assets/js/sections/logbookadvanced.js @@ -2032,7 +2032,6 @@ function saveOptions() { $('#checkUpdateDistancesBtn').prop("disabled", true).addClass("running"); $('#closeButton').prop("disabled", true); - $.ajax({ url: base_url + 'index.php/logbookadvanced/checkDb', data: { @@ -2042,23 +2041,20 @@ function saveOptions() { success: function(response) { $('#checkUpdateDistancesBtn').prop("disabled", false).removeClass("running"); $('#closeButton').prop("disabled", false); - // Create a nice display for the results - let resultHtml = '
Distance Check Results
'; - resultHtml += '

QSO to update found: ' + (response[0].count) + '

'; - $('.result').html(resultHtml); + $('.result').html(response); }, error: function(xhr, status, error) { - $('#checkUpdateDistancesBtn').prop('disabled', false).text(''); + $('#checkUpdateDistancesBtn').prop("disabled", false).removeClass("running"); $('#closeButton').prop('disabled', false); - let errorMsg = ''; + let errorMsg = 'Error checking distance information'; if (xhr.responseJSON && xhr.responseJSON.message) { errorMsg += ': ' + xhr.responseJSON.message; } BootstrapDialog.alert({ - title: '', + 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 = '
DXCC Check Results
'; - 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(''); $('#closeButton').prop('disabled', false); - let errorMsg = ''; + let errorMsg = 'Error checking DXCC information'; if (xhr.responseJSON && xhr.responseJSON.message) { errorMsg += ': ' + xhr.responseJSON.message; } BootstrapDialog.alert({ - title: '', + 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 = '
Continent Check Results
'; - 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(''); $('#closeButton').prop('disabled', false); - let errorMsg = ''; + let errorMsg = 'Error checking continent information'; if (xhr.responseJSON && xhr.responseJSON.message) { errorMsg += ': ' + xhr.responseJSON.message; } BootstrapDialog.alert({ - title: '', + title: 'Error', message: errorMsg, type: BootstrapDialog.TYPE_DANGER }); @@ -2161,13 +2148,13 @@ function saveOptions() { $('#checkFixStateBtn').prop('disabled', false).text(''); $('#closeButton').prop('disabled', false); - let errorMsg = ''; + let errorMsg = 'Error checking state information'; if (xhr.responseJSON && xhr.responseJSON.message) { errorMsg += ': ' + xhr.responseJSON.message; } BootstrapDialog.alert({ - title: '', + 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 = '
CQ Zone Check Results
'; - 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(''); @@ -2204,7 +2187,7 @@ function saveOptions() { } BootstrapDialog.alert({ - title: '', + 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 = '
ITU Zone Check Results
'; - 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(''); @@ -2241,7 +2220,7 @@ function saveOptions() { } BootstrapDialog.alert({ - title: '', + 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) { ?>
Distance Check Results
QSOs to update found: count; ?> +
+
Continent Check Results
QSOs to update found: count; ?> +
+
DXCC Check Results
QSOs to update found: count; ?> +
+
CQ Zone Check Results
QSOs to update found: count; ?> +
+
ITU Zone Check Results
QSOs to update found: count; ?> +
+ Date: Mon, 8 Dec 2025 21:05:00 +0100 Subject: [PATCH 12/40] Corrected number of counties --- application/libraries/Geojson.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/libraries/Geojson.php b/application/libraries/Geojson.php index 814beaaafc..8d3890dc25 100644 --- a/application/libraries/Geojson.php +++ b/application/libraries/Geojson.php @@ -50,7 +50,7 @@ class Geojson { 248 => ['name' => 'Italy', 'enabled' => true], // 107 provinces 256 => ['name' => 'Madeira Islands', 'enabled' => true], // 1 autonomous region 263 => ['name' => 'Netherlands', 'enabled' => true], // 12 provinces - 266 => ['name' => 'Norway', 'enabled' => true], // 11 counties + 266 => ['name' => 'Norway', 'enabled' => true], // 15 counties 269 => ['name' => 'Poland', 'enabled' => true], // 16 voivodeships 272 => ['name' => 'Portugal', 'enabled' => true], // 18 districts 275 => ['name' => 'Romania', 'enabled' => true], // 42 counties From 6f9f0fad87943caa00bff79731523d897eed3d7e Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Wed, 10 Dec 2025 15:57:19 +0100 Subject: [PATCH 13/40] Added state and callsign link in state qso list --- application/models/Logbookadvanced_model.php | 2 +- application/views/logbookadvanced/showStateQsos.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php index 928e4e21aa..fa2b1707ec 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -1580,7 +1580,7 @@ function fixStateBatch($dxcc) { } function getStateListQsos($dxcc) { - $sql = "SELECT col_call, col_time_on, col_mode, col_submode, col_band, col_state, col_gridsquare, d.name as dxcc_name, station_profile.station_profile_name FROM " . $this->config->item('table_name') . " qsos + $sql = "SELECT col_primary_key, col_call, col_time_on, col_mode, col_submode, col_band, col_state, col_gridsquare, 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 WHERE qsos.COL_DXCC = ? AND station_profile.user_id = ? diff --git a/application/views/logbookadvanced/showStateQsos.php b/application/views/logbookadvanced/showStateQsos.php index d336854deb..a8ec4c93f4 100644 --- a/application/views/logbookadvanced/showStateQsos.php +++ b/application/views/logbookadvanced/showStateQsos.php @@ -11,6 +11,7 @@ Date/Time Mode Band + State Gridsquare DXCC Station @@ -19,10 +20,11 @@ - col_call; ?> + col_primary_key . ')">' . htmlspecialchars($qso->col_call) . ''; ?> col_time_on)); ?> col_mode; ?> col_band; ?> + col_state; ?> col_gridsquare; ?> dxcc_name), "- (/"), ENT_QUOTES, 'UTF-8'); ?> station_profile_name; ?> From b72d9c934851b718d5198101346f1f619015b33a Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Thu, 11 Dec 2025 21:11:53 +0100 Subject: [PATCH 14/40] Fixed DXCC checking for ALL QSOs --- application/controllers/Logbookadvanced.php | 2 +- .../views/logbookadvanced/dbtoolsdialog.php | 4 +- application/views/logbookadvanced/index.php | 2 + assets/js/sections/logbookadvanced.js | 42 +++++++++++++------ 4 files changed, 35 insertions(+), 15 deletions(-) diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php index 88d748a8ee..f343a180cf 100644 --- a/application/controllers/Logbookadvanced.php +++ b/application/controllers/Logbookadvanced.php @@ -945,6 +945,6 @@ public function fixMissingDxcc() { $result = $this->logbookadvanced_model->check_missing_dxcc_id($all); header("Content-Type: application/json"); - echo json_encode($result); + echo json_encode(__("The number of QSOs re-checked for DXCC was") .' ' . $result); } } diff --git a/application/views/logbookadvanced/dbtoolsdialog.php b/application/views/logbookadvanced/dbtoolsdialog.php index 3de1e644fc..1099507201 100644 --- a/application/views/logbookadvanced/dbtoolsdialog.php +++ b/application/views/logbookadvanced/dbtoolsdialog.php @@ -2,7 +2,7 @@
-
@@ -86,7 +86,7 @@

-
diff --git a/application/views/logbookadvanced/index.php b/application/views/logbookadvanced/index.php index 51710bd4a5..eec6dafe00 100644 --- a/application/views/logbookadvanced/index.php +++ b/application/views/logbookadvanced/index.php @@ -70,6 +70,8 @@ let lang_gen_advanced_logbook_problem_updating_distances = ''; let lang_gen_advanced_logbook_distances_updated = ''; + let lang_gen_advanced_logbook_confirm_fix_missing_dxcc = ''; + let homegrid =''; Date: Fri, 12 Dec 2025 09:45:51 +0100 Subject: [PATCH 15/40] Fix updating missing DXCC --- application/controllers/Logbookadvanced.php | 6 +- application/models/Logbookadvanced_model.php | 2 +- .../views/logbookadvanced/checkresult.php | 2 +- .../views/logbookadvanced/dbtoolsdialog.php | 2 +- assets/js/sections/logbookadvanced.js | 87 ++++++++++++------- 5 files changed, 64 insertions(+), 35 deletions(-) diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php index f343a180cf..d1fbf28844 100644 --- a/application/controllers/Logbookadvanced.php +++ b/application/controllers/Logbookadvanced.php @@ -945,6 +945,10 @@ public function fixMissingDxcc() { $result = $this->logbookadvanced_model->check_missing_dxcc_id($all); header("Content-Type: application/json"); - echo json_encode(__("The number of QSOs re-checked for DXCC was") .' ' . $result); + if ($all == 'false') { + echo json_encode(__("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); + } } } diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php index fa2b1707ec..21881dcc67 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -1605,7 +1605,7 @@ public function check_missing_dxcc_id($all = false) { $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')); - if (!$all) { // check which to update - records with no dxcc or all records + if ($all == 'false') { // check which to update - records with no dxcc or all records $this->db->group_start(); $this->db->where("COL_DXCC is NULL"); $this->db->or_where("COL_DXCC = ''"); diff --git a/application/views/logbookadvanced/checkresult.php b/application/views/logbookadvanced/checkresult.php index 73d4f7a05b..7e4bf0e92a 100644 --- a/application/views/logbookadvanced/checkresult.php +++ b/application/views/logbookadvanced/checkresult.php @@ -42,7 +42,7 @@ function check_missing_dxcc($result) { ?>
DXCC Check Results
QSOs to update found: count; ?>
-

-
diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js index e366fa0d98..a310f85fdf 100644 --- a/assets/js/sections/logbookadvanced.js +++ b/assets/js/sections/logbookadvanced.js @@ -2296,36 +2296,61 @@ function saveOptions() { } - function fixMissingDxcc() { - $('#updateDxccBtn').prop("disabled", true).addClass("running"); - BootstrapDialog.confirm({ - title: lang_general_word_danger, - message: lang_gen_advanced_logbook_confirm_fix_missing_dxcc, - type: BootstrapDialog.TYPE_DANGER, - closable: true, - draggable: true, - btnOKClass: 'btn-danger', - callback: function(result) { - if(result) { - $.ajax({ - url: base_url + 'index.php/logbookadvanced/fixMissingDxcc', - type: 'post', - data: { - all: 'false' - }, - success: function(data) { - $('#updateDxccBtn').prop("disabled", false).removeClass("running"); - $('.result').html(data); - }, - error: function(xhr, status, error) { - $('#updateDxccBtn').prop("disabled", false).removeClass("running"); - $('.result').html(error); - } - }) - } else { - $('#updateDxccBtn').prop("disabled", false).removeClass("running"); - } + function fixMissingDxcc(all) { + if (all === true) { + $('#updateDxccBtn').prop("disabled", true).addClass("running"); + BootstrapDialog.confirm({ + title: lang_general_word_danger, + message: lang_gen_advanced_logbook_confirm_fix_missing_dxcc, + type: BootstrapDialog.TYPE_DANGER, + closable: true, + draggable: true, + btnOKClass: 'btn-danger', + callback: function(result) { + if(result) { + $('#closeButton').prop("disabled", true); + $.ajax({ + url: base_url + 'index.php/logbookadvanced/fixMissingDxcc', + type: 'post', + data: { + all: all + }, + success: function(data) { + $('#updateDxccBtn').prop("disabled", false).removeClass("running"); + $('.result').html(data); + $('#closeButton').prop("disabled", false); + }, + error: function(xhr, status, error) { + $('#updateDxccBtn').prop("disabled", false).removeClass("running"); + $('#closeButton').prop("disabled", false); + $('.result').html(error); + } + }) + } else { + $('#updateDxccBtn').prop("disabled", false).removeClass("running"); + } - }, - }); + }, + }); + } else { + $('#fixMissingDxccBtn').prop("disabled", true).addClass("running"); + $('#closeButton').prop("disabled", true); + $.ajax({ + url: base_url + 'index.php/logbookadvanced/fixMissingDxcc', + type: 'post', + data: { + all: all + }, + success: function(data) { + $('#fixMissingDxccBtn').prop("disabled", false).removeClass("running"); + $('.result').html(data); + $('#closeButton').prop("disabled", false); + }, + error: function(xhr, status, error) { + $('#fixMissingDxccBtn').prop("disabled", false).removeClass("running"); + $('#closeButton').prop("disabled", false); + $('.result').html(error); + } + }) + } } From dc9a7ad95ee9e1a672e1bdde8b8c750b70927d0b Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Sat, 13 Dec 2025 12:04:59 +0100 Subject: [PATCH 16/40] Add QSO list for missing DXCC --- application/controllers/Logbookadvanced.php | 11 +++ application/models/Logbookadvanced_model.php | 19 +++- .../views/logbookadvanced/checkresult.php | 9 +- assets/js/sections/logbookadvanced.js | 94 ++++++++++++++----- 4 files changed, 105 insertions(+), 28 deletions(-) diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php index d1fbf28844..afabcdc249 100644 --- a/application/controllers/Logbookadvanced.php +++ b/application/controllers/Logbookadvanced.php @@ -951,4 +951,15 @@ public function fixMissingDxcc() { echo json_encode(__("The number of QSOs re-checked for DXCC was") .' ' . $result); } } + + public function openMissingDxccList() { + if(!clubaccess_check(9)) return; + + $this->load->model('logbookadvanced_model'); + + $data['qsos'] = $this->logbookadvanced_model->getMissingDxccQsos(); + + $this->load->view('logbookadvanced/showMissingDxccQsos', $data); + } + } diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php index 21881dcc67..56a22f707a 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -1491,7 +1491,11 @@ public function check_qsos_missing_continent() { public function check_missing_distance() { $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_distance, '') = ''"; + where user_id = ? + AND (COL_DISTANCE = '' or COL_DISTANCE is NULL) + and COL_GRIDSQUARE != station_gridsquare + and COL_GRIDSQUARE is NOT NULL + and COL_GRIDSQUARE != ''"; $bindings[] = [$this->session->userdata('user_id')]; @@ -1632,4 +1636,17 @@ public function check_missing_dxcc_id($all = false) { $this->db->trans_complete(); return $count; } + + function getMissingDxccQsos() { + $sql = "SELECT col_primary_key, col_call, col_time_on, col_mode, col_submode, col_band, col_state, col_gridsquare, 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 + WHERE station_profile.user_id = ? + AND (qsos.COL_DXCC IS NULL OR qsos.COL_DXCC = '') + ORDER BY COL_TIME_ON DESC"; + + $query = $this->db->query($sql, [$this->session->userdata('user_id')]); + + return $query->result(); + } } diff --git a/application/views/logbookadvanced/checkresult.php b/application/views/logbookadvanced/checkresult.php index 7e4bf0e92a..b050a3a935 100644 --- a/application/views/logbookadvanced/checkresult.php +++ b/application/views/logbookadvanced/checkresult.php @@ -24,9 +24,15 @@ function check_missing_distance($result) { ?>
Distance Check Results
QSOs to update found: count; ?>
- + @@ -45,6 +51,7 @@ function check_missing_dxcc($result) { ?> + diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js index a310f85fdf..627d850d36 100644 --- a/assets/js/sections/logbookadvanced.js +++ b/assets/js/sections/logbookadvanced.js @@ -1360,32 +1360,7 @@ $(document).ready(function () { }); }); - function runUpdateDistancesFix(dialogItself) { - $('#updateDistanceButton').prop("disabled", true).addClass("running"); - $('#closeButton').prop("disabled", true); - $.ajax({ - url: base_url + 'index.php/logbookadvanced/updateDistances', - type: 'POST', - success: function (response) { - $('#updateDistanceButton').prop("disabled", false).removeClass("running"); - 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 - }); - }, - error: function () { - $('#updateDistanceButton').prop("disabled", false).removeClass("running"); - dialogItself.close(); - BootstrapDialog.alert({ - title: lang_gen_advanced_logbook_error, - message: lang_gen_advanced_logbook_problem_updating_distances, - type: BootstrapDialog.TYPE_DANGER - }); - } - }); - } + $('#fixItuZones').click(function (event) { const id_list = getSelectedIds(); @@ -2354,3 +2329,70 @@ function saveOptions() { }) } } + + function runUpdateDistancesFix(dialogItself) { + $('#updateDistanceButton').prop("disabled", true).addClass("running"); + $('#closeButton').prop("disabled", true); + $.ajax({ + url: base_url + 'index.php/logbookadvanced/updateDistances', + type: 'POST', + success: function (response) { + $('#updateDistanceButton').prop("disabled", false).removeClass("running"); + $('#closeButton').prop("disabled", false); + 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 + }); + }, + error: function () { + $('#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 + }); + $('#closeButton').prop("disabled", false); + } + }); + } + + function openMissingDxccList() { + $('#openMissingDxccListBtn').prop("disabled", true).addClass("running"); + + $.ajax({ + url: base_url + 'index.php/logbookadvanced/openMissingDxccList', + type: 'post', + success: function (response) { + $('#openMissingDxccListBtn').prop("disabled", false).removeClass("running"); + BootstrapDialog.show({ + title: 'QSO List', + size: BootstrapDialog.SIZE_WIDE, + cssClass: 'options', + nl2br: false, + message: response, + buttons: [ + { + label: lang_admin_close, + cssClass: 'btn-sm btn-secondary', + id: 'closeButton', + action: function (dialogItself) { + dialogItself.close(); + } + }], + onhide: function(dialogRef){ + return; + }, + }); + }, + error: function () { + $('#openMissingDxccListBtn').prop("disabled", false).removeClass("running"); + } + }); + } From 3d0949cbdc23b1adb959b8d5d6c7d6b1e1a0cad7 Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Sat, 13 Dec 2025 13:56:21 +0100 Subject: [PATCH 17/40] Added changed files --- .../views/logbookadvanced/checkresult.php | 2 +- .../logbookadvanced/showMissingDxccQsos.php | 41 +++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 application/views/logbookadvanced/showMissingDxccQsos.php diff --git a/application/views/logbookadvanced/checkresult.php b/application/views/logbookadvanced/checkresult.php index b050a3a935..d3c8087a04 100644 --- a/application/views/logbookadvanced/checkresult.php +++ b/application/views/logbookadvanced/checkresult.php @@ -30,7 +30,7 @@ function check_missing_distance($result) { ?>
+ 0): ?> +
+

+ Found QSO(s) missing DXCC information. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
CallDate/TimeModeBandStateGridsquareDXCCStation
col_primary_key . ')">' . htmlspecialchars($qso->col_call) . ''; ?>col_time_on)); ?>col_mode; ?>col_band; ?>col_state; ?>col_gridsquare; ?>dxcc_name; ?>station_profile_name; ?>
+
+ +
+

No Issues Found

+
+ +
From 82fbbb84f98446c6deab1d0d4855893476d8fb6e Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Sat, 13 Dec 2025 20:45:37 +0100 Subject: [PATCH 18/40] Continent update is fixed --- application/models/Logbookadvanced_model.php | 8 ++- .../views/logbookadvanced/checkresult.php | 11 +++- .../views/logbookadvanced/dbtoolsdialog.php | 2 +- application/views/logbookadvanced/index.php | 2 - assets/js/sections/logbookadvanced.js | 58 ++++++++++--------- 5 files changed, 46 insertions(+), 35 deletions(-) diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php index 56a22f707a..99a63b8348 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -1397,7 +1397,8 @@ public function check_missing_continent() { JOIN dxcc_entities ON " . $this->config->item('table_name') . ".col_dxcc = dxcc_entities.adif JOIN station_profile on " . $this->config->item('table_name') . ".station_id = station_profile.station_id SET col_cont = dxcc_entities.cont - WHERE COALESCE(" . $this->config->item('table_name') . ".col_cont, '') = '' and station_profile.user_id = ?"; + WHERE (COALESCE(" . $this->config->item('table_name') . ".col_cont, '') = '' or " . $this->config->item('table_name') . ".col_cont not in ('AF', 'AN', 'AS', 'EU', 'NA', 'OC', 'SA')) + and station_profile.user_id = ?"; $query = $this->db->query($sql, array($this->session->userdata('user_id'))); $result = $this->db->affected_rows(); @@ -1480,7 +1481,10 @@ public function check_qsos_missing_continent() { $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_cont, '') = '' or col_cont not in ('AF', 'AN', 'AS', 'EU', 'NA', 'OC', 'SA'))"; + and (coalesce(col_cont, '') = '' or col_cont not in ('AF', 'AN', 'AS', 'EU', 'NA', 'OC', 'SA')) + and col_dxcc is not null + and col_dxcc != '' + and col_dxcc != 0"; $bindings[] = [$this->session->userdata('user_id')]; diff --git a/application/views/logbookadvanced/checkresult.php b/application/views/logbookadvanced/checkresult.php index d3c8087a04..faf15a39b2 100644 --- a/application/views/logbookadvanced/checkresult.php +++ b/application/views/logbookadvanced/checkresult.php @@ -28,7 +28,7 @@ function check_missing_distance($result) { ?>

-
+
@@ -39,8 +39,13 @@ function check_qsos_missing_continent($result) { ?>
Continent Check Results
QSOs to update found: count; ?>
-
-

+

- -
diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js index 627d850d36..66a2ac981e 100644 --- a/assets/js/sections/logbookadvanced.js +++ b/assets/js/sections/logbookadvanced.js @@ -1275,33 +1275,6 @@ $(document).ready(function () { }); }); - function runContinentFix(dialogItself) { - $('#updateContinentButton').prop("disabled", true).addClass("running"); - $('#closeButton').prop("disabled", true); - $.ajax({ - url: base_url + 'index.php/logbookadvanced/fixContinent', - type: 'POST', - success: function (response) { - $('#updateContinentButton').prop("disabled", false).removeClass("running"); - 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 - }); - }, - error: function () { - $('#updateContinentButton').prop("disabled", false).removeClass("running"); - dialogItself.close(); - BootstrapDialog.alert({ - title: lang_gen_advanced_logbook_error, - message: lang_gen_advanced_logbook_problem_fixing_continents, - type: BootstrapDialog.TYPE_DANGER - }); - } - }); - } - $('#updateDistances').click(function (event) { $.ajax({ url: base_url + 'index.php/logbookadvanced/distanceDialog', @@ -2396,3 +2369,34 @@ function saveOptions() { } }); } + + function runContinentFix(dialogItself) { + $('#updateContinentButton').prop("disabled", true).addClass("running"); + $('#closeButton').prop("disabled", true); + $.ajax({ + url: base_url + 'index.php/logbookadvanced/fixContinent', + type: 'POST', + success: function (response) { + $('#updateContinentButton').prop("disabled", false).removeClass("running"); + 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 + }); + }, + error: function () { + $('#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 + }); + } + }); + } From b70c12838ed1da9065dd5077219465c75eb22e5a Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Sun, 14 Dec 2025 09:33:01 +0100 Subject: [PATCH 19/40] Fixed CQ/ITU zone updater --- application/controllers/Logbookadvanced.php | 10 +++- application/models/Logbookadvanced_model.php | 40 ++++++++++++- .../views/logbookadvanced/checkresult.php | 8 +-- assets/js/sections/logbookadvanced.js | 60 +++++++++++++++++++ 4 files changed, 111 insertions(+), 7 deletions(-) diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php index afabcdc249..ab64bfd85b 100644 --- a/application/controllers/Logbookadvanced.php +++ b/application/controllers/Logbookadvanced.php @@ -785,7 +785,6 @@ public function fixCqZones() { header("Content-Type: application/json"); print json_encode($q); - } public function fixItuZones() { @@ -962,4 +961,13 @@ public function openMissingDxccList() { $this->load->view('logbookadvanced/showMissingDxccQsos', $data); } + public function batchFix() { + $type = $this->input->post('type', true); + $this->load->model('logbookadvanced_model'); + $result = $this->logbookadvanced_model->batchFix($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 99a63b8348..ae10905349 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -1255,21 +1255,38 @@ function getSubdivisons($dxccid) { return $query->result(); } - function fixCqZones($ids) { + function fixCqZones($ids = null) { + if ($ids == null) { + $sql = "UPDATE ".$this->config->item('table_name')." JOIN dxcc_entities ON ". $this->config->item('table_name').".col_dxcc = dxcc_entities.adif JOIN station_profile ON ". $this->config->item('table_name').".station_id = station_profile.station_id" . + " SET " . $this->config->item('table_name').".COL_CQZ = dxcc_entities.cqz" . + " WHERE station_profile.user_id = ? and (" . $this->config->item('table_name').".COL_CQZ IS NULL OR " . $this->config->item('table_name').".COL_CQZ = '')"; + + $query = $this->db->query($sql, array($this->session->userdata('user_id'))); + return $this->db->affected_rows(); + } $sql = "UPDATE ".$this->config->item('table_name')." JOIN dxcc_entities ON ". $this->config->item('table_name').".col_dxcc = dxcc_entities.adif JOIN station_profile ON ". $this->config->item('table_name').".station_id = station_profile.station_id" . " SET " . $this->config->item('table_name').".COL_CQZ = dxcc_entities.cqz" . " WHERE " . $this->config->item('table_name').".col_primary_key in ? and station_profile.user_id = ?"; $query = $this->db->query($sql, array(json_decode($ids, true), $this->session->userdata('user_id'))); + return $this->db->affected_rows(); } - function fixItuZones($ids) { + function fixItuZones($ids = null) { + if ($ids == null) { + $sql = "UPDATE ".$this->config->item('table_name')." JOIN dxcc_entities ON ". $this->config->item('table_name').".col_dxcc = dxcc_entities.adif JOIN station_profile ON ". $this->config->item('table_name').".station_id = station_profile.station_id" . + " SET " . $this->config->item('table_name').".COL_ITUZ = dxcc_entities.ituz" . + " WHERE station_profile.user_id = ? and (" . $this->config->item ('table_name').".COL_ITUZ IS NULL OR " . $this->config->item('table_name').".COL_ITUZ = '')"; + $query = $this->db->query($sql, array($this->session->userdata('user_id'))); + return $this->db->affected_rows(); + } $sql = "UPDATE ".$this->config->item('table_name')." JOIN dxcc_entities ON ". $this->config->item('table_name').".col_dxcc = dxcc_entities.adif JOIN station_profile ON ". $this->config->item('table_name').".station_id = station_profile.station_id" . " SET " . $this->config->item('table_name').".COL_ITUZ = dxcc_entities.ituz" . " WHERE " . $this->config->item('table_name').".col_primary_key in ? and station_profile.user_id = ?"; $query = $this->db->query($sql, array(json_decode($ids, true), $this->session->userdata('user_id'))); + return $this->db->affected_rows(); } /** @@ -1530,6 +1547,7 @@ public function check_missing_state() { 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 + join dxcc_entities on " . $this->config->item('table_name') . ".col_dxcc = dxcc_entities.adif where user_id = ? and coalesce(col_cqz, '') = ''"; $bindings[] = [$this->session->userdata('user_id')]; @@ -1541,6 +1559,7 @@ public function check_missing_cq_zones() { 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 + join dxcc_entities on " . $this->config->item('table_name') . ".col_dxcc = dxcc_entities.adif where user_id = ? and coalesce(col_ituz, '') = ''"; $bindings[] = [$this->session->userdata('user_id')]; @@ -1653,4 +1672,21 @@ function getMissingDxccQsos() { return $query->result(); } + + function batchFix($type) { + switch ($type) { + case 'dxcc': + return $this->check_missing_dxcc_id('true'); + case 'distance': + return $this->update_distances_batch(); + case 'continent': + return $this->check_missing_continent(); + case 'cqzones': + return $this->fixCqZones(); + case 'ituzones': + return $this->fixItuZones(); + default: + return null; + } + } } diff --git a/application/views/logbookadvanced/checkresult.php b/application/views/logbookadvanced/checkresult.php index faf15a39b2..1d77715455 100644 --- a/application/views/logbookadvanced/checkresult.php +++ b/application/views/logbookadvanced/checkresult.php @@ -63,8 +63,8 @@ function check_missing_cq_zones($result) { ?>
CQ Zone Check Results
QSOs to update found: count; ?>
-
ITU Zone Check Results
QSOs to update found: count; ?>
- Date: Sun, 14 Dec 2025 10:57:47 +0100 Subject: [PATCH 20/40] Changed wording a bit --- application/views/logbookadvanced/dbtoolsdialog.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/application/views/logbookadvanced/dbtoolsdialog.php b/application/views/logbookadvanced/dbtoolsdialog.php index 1db1fa1d5a..7fd0359ad4 100644 --- a/application/views/logbookadvanced/dbtoolsdialog.php +++ b/application/views/logbookadvanced/dbtoolsdialog.php @@ -2,15 +2,15 @@
- -
+ +
-

+

@@ -44,7 +44,7 @@ function check_qsos_missing_continent($result) { ?>


-
CQ Zone Check Results
QSOs to update found: count; ?>
-
ITU Zone Check Results
QSOs to update found: count; ?>
- Date: Sun, 14 Dec 2025 11:34:45 +0100 Subject: [PATCH 22/40] Moved function from model, and added userid --- application/models/Logbook_model.php | 44 ------------------- application/models/Logbookadvanced_model.php | 46 ++++++++++++++++++++ 2 files changed, 46 insertions(+), 44 deletions(-) diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 6935ca62f0..bfa3a06577 100644 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -5996,50 +5996,6 @@ public function get_entity($dxcc) { return ''; } - public function check_missing_grid_id($all) { - // get all records with no COL_GRIDSQUARE - $this->db->select("COL_PRIMARY_KEY, COL_CALL, COL_TIME_ON, COL_TIME_OFF"); - - $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')); - - $count = 0; - $this->db->trans_start(); - if ($r->num_rows() > 0) { - foreach ($r->result_array() as $row) { - $callsign = $row['COL_CALL']; - if (!$this->load->is_loaded('callbook')) { - $this->load->library('callbook'); - } - - $callbook = $this->callbook->getCallbookData($callsign); - - if (isset($callbook)) { - if (isset($callbook['error'])) { - printf("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']); - $count++; - } - } - } - } - } - $this->db->trans_complete(); - - print("$count updated\n"); - } - public function check_for_station_id() { $this->db->select('COL_PRIMARY_KEY, COL_TIME_ON, COL_CALL, COL_MODE, COL_BAND, COL_STATION_CALLSIGN'); $this->db->where('station_id =', NULL); diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php index ae10905349..4ee468e17c 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -1689,4 +1689,50 @@ function batchFix($type) { return null; } } + + public function check_missing_grid_id($all) { + // get all records with no COL_GRIDSQUARE + $this->db->select("COL_PRIMARY_KEY, COL_CALL, COL_TIME_ON, COL_TIME_OFF"); + $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')); + + $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')); + + $count = 0; + $this->db->trans_start(); + if ($r->num_rows() > 0) { + foreach ($r->result_array() as $row) { + $callsign = $row['COL_CALL']; + if (!$this->load->is_loaded('callbook')) { + $this->load->library('callbook'); + } + + $callbook = $this->callbook->getCallbookData($callsign); + + if (isset($callbook)) { + if (isset($callbook['error'])) { + printf("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']); + $count++; + } + } + } + } + } + $this->db->trans_complete(); + + print("$count updated\n"); + } } From 00b53970942cac6f7772d9e9c02469c208d91f48 Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Sun, 14 Dec 2025 13:23:53 +0100 Subject: [PATCH 23/40] Adding translations --- .../views/logbookadvanced/checkresult.php | 20 +++++++++---------- .../logbookadvanced/showMissingDxccQsos.php | 18 ++++++++--------- .../views/logbookadvanced/showStateQsos.php | 18 ++++++++--------- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/application/views/logbookadvanced/checkresult.php b/application/views/logbookadvanced/checkresult.php index 2554be3ec8..8eec479483 100644 --- a/application/views/logbookadvanced/checkresult.php +++ b/application/views/logbookadvanced/checkresult.php @@ -21,8 +21,8 @@ } function check_missing_distance($result) { ?> -
Distance Check Results
- QSOs to update found: count; ?> +
+ count; ?>

@@ -36,8 +36,8 @@ function check_missing_distance($result) { ?> -
Continent Check Results
- QSOs to update found: count; ?> +
+ count; ?>

@@ -50,8 +50,8 @@ function check_qsos_missing_continent($result) { ?> -
DXCC Check Results
- QSOs to update found: count; ?> +
+ count; ?>