From db42a27da73cc0c9913410a2f7ae218666342c26 Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Sat, 27 Dec 2025 16:34:37 +0100 Subject: [PATCH 1/6] [Advanced Logbook] Added gridsquare/cq/itu checker --- application/models/Logbookadvanced_model.php | 84 +++++++ .../views/logbookadvanced/checkresult.php | 195 ++++++++++++++++ .../views/logbookadvanced/dbtoolsdialog.php | 35 +++ application/views/logbookadvanced/index.php | 4 + assets/js/sections/logbookadvanced.js | 210 ++++++++++++++++-- 5 files changed, 508 insertions(+), 20 deletions(-) diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php index a2a05b5d5..ef2e4ef62 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -1549,10 +1549,54 @@ class Logbookadvanced_model extends CI_Model { return $this->check_missing_itu_zones(); case 'checkgrids': return $this->getMissingGridQsos(); + case 'checkincorrectgridsquares': + return $this->getIncorrectGridsquares(); + case 'checkincorrectcqzones': + return $this->getIncorrectCqZones(); + case 'checkincorrectituzones': + return $this->getIncorrectItuZones(); return null; } } + public function getIncorrectGridsquares() { + $sqlcheck = "select count(*) as count from vuccgrids";; + $querycheck = $this->db->query($sqlcheck); + $rowcheck = $querycheck->row(); + if ($rowcheck->count == 0) { + return ['status' => 'error', 'message' => __("VuccGrids table is empty. Please import the VUCC grids data first.")]; + } + + $sql = "select col_primary_key, col_time_on, col_call, col_band, col_gridsquare, col_dxcc, col_country, station_profile_name, + ( + select group_concat(distinct gridsquare order by gridsquare separator ', ') + from vuccgrids + where adif = thcv.col_dxcc + order by gridsquare asc + ) as correctgridsquare + from " . $this->config->item('table_name') . " thcv + join station_profile on thcv.station_id = station_profile.station_id + join dxcc_entities on dxcc_entities.adif = thcv.COL_DXCC + where station_profile.user_id = ? + and thcv.col_dxcc > 0 + and not exists ( + select 1 + from vuccgrids + where adif = thcv.col_dxcc + and gridsquare = substr(thcv.col_gridsquare, 1, 4) + ) + and exists (select 1 from vuccgrids where adif = thcv.col_dxcc) + and thcv.col_dxcc > 0 + and thcv.col_gridsquare is not null + and thcv.col_gridsquare <> '' + order by station_profile_name, col_time_on desc"; + + $bindings[] = [$this->session->userdata('user_id')]; + + $query = $this->db->query($sql, $bindings); + return $query->result(); + } + public function check_missing_dxcc() { $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 @@ -1980,4 +2024,44 @@ class Logbookadvanced_model extends CI_Model { $result['count'] = $count; return $result; } + + function getIncorrectCqZones() { + if(!clubaccess_check(9)) return; + + $sql = "select *, (select group_concat(distinct cqzone order by cqzone separator ', ') from dxcc_master where countrycode = thcv.col_dxcc and cqzone <> '' order by cqzone asc) as correctcqzone + from " . $this->config->item('table_name') . " thcv + join station_profile on thcv.station_id = station_profile.station_id + where station_profile.user_id = ? + and not exists (select 1 from dxcc_master where countrycode = thcv.col_dxcc and cqzone = col_cqz) and col_dxcc > 0 + "; + + $params[] = $this->session->userdata('user_id'); + + $sql .= " order by station_profile.station_profile_name, thcv.col_time_on desc + limit 5000"; + + $query = $this->db->query($sql, $params); + + return $query->result(); + } + + function getIncorrectItuZones() { + if(!clubaccess_check(9)) return; + + $sql = "select *, (select group_concat(distinct ituzone order by ituzone separator ', ') from dxcc_master where countrycode = thcv.col_dxcc and ituzone <> '' order by ituzone asc) as correctituzone + from " . $this->config->item('table_name') . " thcv + join station_profile on thcv.station_id = station_profile.station_id + where station_profile.user_id = ? + and not exists (select 1 from dxcc_master where countrycode = thcv.col_dxcc and ituzone = col_ituz) and col_dxcc > 0 + "; + + $params[] = $this->session->userdata('user_id'); + + $sql .= " order by station_profile.station_profile_name, thcv.col_time_on desc + limit 5000"; + + $query = $this->db->query($sql, $params); + + return $query->result(); + } } diff --git a/application/views/logbookadvanced/checkresult.php b/application/views/logbookadvanced/checkresult.php index a7ce37d6b..5ae33b3d6 100644 --- a/application/views/logbookadvanced/checkresult.php +++ b/application/views/logbookadvanced/checkresult.php @@ -31,6 +31,15 @@ switch ($type) { case 'checkdxcc': check_dxcc($result, $custom_date_format); break; + case 'checkincorrectgridsquares': + check_incorrect_gridsquares($result, $custom_date_format); + break; + case 'checkincorrectcqzones': + check_incorrect_cq_zones($result, $custom_date_format); + break; + case 'checkincorrectituzones': + check_incorrect_itu_zones($result, $custom_date_format); + break; default: // Invalid type break; @@ -154,3 +163,189 @@ function check_dxcc($result, $custom_date_format) { ?> +
+ ' . htmlspecialchars($result['message']) . ''; + return; + } + if ($result) { ?> + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
col_primary_key . ')">' . htmlspecialchars($qso->col_call) . ''; ?>col_time_on)); ?>station_profile_name; ?>col_country), "- (/"), ENT_QUOTES, 'UTF-8'); ?>col_gridsquare; ?> + correctgridsquare; + $maxChars = 50; + if (strlen($gridsquare) > $maxChars) { + $truncated = substr($gridsquare, 0, $maxChars); + $uniqueId = 'gridsquare-' . $qso->col_primary_key; + echo '' . htmlspecialchars($truncated) . '... '; + echo ' '; + echo '' . __('Show more') . ''; + } else { + echo htmlspecialchars($gridsquare); + } + ?> +
+
+ + +
+ + + + ' . __("Date") . ' + ' . __("Time") . ' + ' . __("Callsign") . ' + ' . __("Mode") . ' + ' . __("Band") . ' + ' . __("Gridsquare") . ' + ' . __("CQ Zone") . ' + ' . __("DXCC CQ Zone") . ' + ' . __("DXCC") . ' + ' . __("Station") . ' + + '; + + $i = 0; + + foreach ($result as $qso) { + echo ''; + echo ''; $timestamp = strtotime($qso->COL_TIME_ON); echo date($custom_date_format, $timestamp); echo ''; + echo ''; $timestamp = strtotime($qso->COL_TIME_ON); echo date('H:i', $timestamp); echo ''; + echo '' . str_replace("0","Ø",strtoupper($qso->COL_CALL)) . ''; + echo ''; echo $qso->COL_SUBMODE==null?$qso->COL_MODE:$qso->COL_SUBMODE; echo ''; + echo ''; if($qso->COL_SAT_NAME != null) { echo $qso->COL_SAT_NAME; } else { echo strtolower($qso->COL_BAND); }; echo ''; + echo ''; echo strlen($qso->COL_GRIDSQUARE ?? '')==0?$qso->COL_VUCC_GRIDS:$qso->COL_GRIDSQUARE; echo ''; + echo '' . $qso->COL_CQZ . ''; + echo '' . $qso->correctcqzone . ''; + echo '' . ucwords(strtolower($qso->COL_COUNTRY), "- (/") . ''; + echo '' . $qso->station_profile_name . ''; + echo ''; + } + + echo ' + + + + + + + + + + + + + + + '; + ?> + + ' . __("No incorrect CQ Zones were found.") . ''; + } +} + +function check_incorrect_itu_zones($result, $custom_date_format) { ?> +
+ + + + ' . __("Date") . ' + ' . __("Time") . ' + ' . __("Callsign") . ' + ' . __("Mode") . ' + ' . __("Band") . ' + ' . __("Gridsquare") . ' + ' . __("ITU Zone") . ' + ' . __("DXCC ITU Zone") . ' + ' . __("DXCC") . ' + ' . __("Station") . ' + + '; + + $i = 0; + + foreach ($result as $qso) { + echo ''; + echo ''; $timestamp = strtotime($qso->COL_TIME_ON); echo date($custom_date_format, $timestamp); echo ''; + echo ''; $timestamp = strtotime($qso->COL_TIME_ON); echo date('H:i', $timestamp); echo ''; + echo '' . str_replace("0","Ø",strtoupper($qso->COL_CALL)) . ''; + echo ''; echo $qso->COL_SUBMODE==null?$qso->COL_MODE:$qso->COL_SUBMODE; echo ''; + echo ''; if($qso->COL_SAT_NAME != null) { echo $qso->COL_SAT_NAME; } else { echo strtolower($qso->COL_BAND); }; echo ''; + echo ''; echo strlen($qso->COL_GRIDSQUARE ?? '')==0?$qso->COL_VUCC_GRIDS:$qso->COL_GRIDSQUARE; echo ''; + echo '' . $qso->COL_ITUZ . ''; + echo '' . $qso->correctituzone . ''; + echo '' . ucwords(strtolower($qso->COL_COUNTRY), "- (/") . ''; + echo '' . $qso->station_profile_name . ''; + echo ''; + } + + echo ' + + + + + + + + + + + + + + + '; + ?> + + ' . __("No incorrect CQ Zones were found.") . ''; + } +} diff --git a/application/views/logbookadvanced/dbtoolsdialog.php b/application/views/logbookadvanced/dbtoolsdialog.php index 149a43cda..e67884cee 100644 --- a/application/views/logbookadvanced/dbtoolsdialog.php +++ b/application/views/logbookadvanced/dbtoolsdialog.php @@ -17,6 +17,17 @@ +
+
+
+

+
+
+ +
+
@@ -30,6 +41,30 @@
+
+
+
+

+
+
+ +
+
+ +
+
+
+

+
+
+ +
+
+
diff --git a/application/views/logbookadvanced/index.php b/application/views/logbookadvanced/index.php index 1f999da0e..6b5d55385 100644 --- a/application/views/logbookadvanced/index.php +++ b/application/views/logbookadvanced/index.php @@ -74,6 +74,10 @@ let lang_gen_advanced_logbook_dupe_search = ''; let lang_gen_advanced_logbook_search = ''; + let lang_gen_advanced_logbook_show_more = ''; + let lang_gen_advanced_logbook_show_less = ''; + + let homegrid =''; '); + $('#checkGridsBtn').prop("disabled", false).removeClass("running"); $('#closeButton').prop('disabled', false); - let errorMsg = 'Error checking continent information'; - if (xhr.responseJSON && xhr.responseJSON.message) { - errorMsg += ': ' + xhr.responseJSON.message; - } - - BootstrapDialog.alert({ - title: 'Error', - message: errorMsg, - type: BootstrapDialog.TYPE_DANGER - }); + $('.result').html(error); } }); } @@ -2532,19 +2523,125 @@ function saveOptions() { rebind_checkbox_trigger_dxcc(); }, error: function(xhr, status, error) { - $('#checkDxccBtn').prop('disabled', false).text(''); + $('#checkDxccBtn').prop("disabled", false).removeClass("running"); $('#closeButton').prop('disabled', false); + $('.result').html(error); + } + }); + } - let errorMsg = 'Error checking DXCC information'; - if (xhr.responseJSON && xhr.responseJSON.message) { - errorMsg += ': ' + xhr.responseJSON.message; - } + function checkIncorrectCqZones() { + $('#checkIncorrectCqZonesBtn').prop("disabled", true).addClass("running"); + $('#closeButton').prop("disabled", true); - BootstrapDialog.alert({ - title: 'Error', - message: errorMsg, - type: BootstrapDialog.TYPE_DANGER + $.ajax({ + url: base_url + 'index.php/logbookadvanced/checkDb', + data: { + type: 'checkincorrectcqzones' + }, + type: 'POST', + success: function(response) { + $('#checkIncorrectCqZonesBtn').prop("disabled", false).removeClass("running"); + $('#closeButton').prop("disabled", false); + $('.result').html(response); + $('#incorrectcqzonetable').DataTable({ + "pageLength": 25, + responsive: false, + ordering: false, + "scrollY": "510px", + "scrollCollapse": true, + "paging": false, + "scrollX": false, + "language": { + url: getDataTablesLanguageUrl(), + }, + initComplete: function () { + this.api() + .columns('.select-filter') + .every(function () { + var column = this; + var select = $('') + .appendTo($(column.footer()).empty()) + .on('change', function () { + var val = $.fn.dataTable.util.escapeRegex($(this).val()); + + column.search(val ? '^' + val + '$' : '', true, false).draw(); + }); + + column + .data() + .unique() + .sort() + .each(function (d, j) { + select.append(''); + }); + }); + }, }); + + }, + error: function(xhr, status, error) { + $('#checkIncorrectCqZonesBtn').prop("disabled", false).removeClass("running"); + $('#closeButton').prop('disabled', false); + $('.result').html(error); + } + }); + } + + function checkIncorrectItuZones() { + $('#checkIncorrectItuZonesBtn').prop("disabled", true).addClass("running"); + $('#closeButton').prop("disabled", true); + + $.ajax({ + url: base_url + 'index.php/logbookadvanced/checkDb', + data: { + type: 'checkincorrectituzones' + }, + type: 'POST', + success: function(response) { + $('#checkIncorrectItuZonesBtn').prop("disabled", false).removeClass("running"); + $('#closeButton').prop("disabled", false); + $('.result').html(response); + $('#incorrectituzonetable').DataTable({ + "pageLength": 25, + responsive: false, + ordering: false, + "scrollY": "510px", + "scrollCollapse": true, + "paging": false, + "scrollX": false, + "language": { + url: getDataTablesLanguageUrl(), + }, + initComplete: function () { + this.api() + .columns('.select-filter') + .every(function () { + var column = this; + var select = $('') + .appendTo($(column.footer()).empty()) + .on('change', function () { + var val = $.fn.dataTable.util.escapeRegex($(this).val()); + + column.search(val ? '^' + val + '$' : '', true, false).draw(); + }); + + column + .data() + .unique() + .sort() + .each(function (d, j) { + select.append(''); + }); + }); + }, + }); + + }, + error: function(xhr, status, error) { + $('#checkIncorrectItuZonesBtn').prop("disabled", false).removeClass("running"); + $('#closeButton').prop('disabled', false); + $('.result').html(error); } }); } @@ -2619,3 +2716,76 @@ function saveOptions() { } }); } + + function checkIncorrectGridsquares() { + $('#checkIncorrectGridsquaresBtn').prop("disabled", true).addClass("running"); + $('#closeButton').prop("disabled", true); + + $.ajax({ + url: base_url + 'index.php/logbookadvanced/checkDb', + data: { + type: 'checkincorrectgridsquares' + }, + type: 'POST', + success: function(response) { + $('#checkIncorrectGridsquaresBtn').prop("disabled", false).removeClass("running"); + $('#closeButton').prop("disabled", false); + $('.result').html(response); + $('#gridsquareCheckTable').DataTable({ + "pageLength": 25, + responsive: false, + ordering: false, + "scrollY": "510px", + "scrollCollapse": true, + "paging": false, + "scrollX": false, + "language": { + url: getDataTablesLanguageUrl(), + }, + initComplete: function () { + this.api() + .columns('.select-filter') + .every(function () { + var column = this; + var select = $('') + .appendTo($(column.footer()).empty()) + .on('change', function () { + var val = $.fn.dataTable.util.escapeRegex($(this).val()); + + column.search(val ? '^' + val + '$' : '', true, false).draw(); + }); + + column + .data() + .unique() + .sort() + .each(function (d, j) { + select.append(''); + }); + }); + }, + }); + }, + error: function(xhr, status, error) { + $('#checkIncorrectGridsquaresBtn').prop("disabled", false).removeClass("running"); + $('#closeButton').prop('disabled', false); + $('.result').html(error); + } + }); + } + + function toggleGridsquare(id) { + const shortSpan = document.getElementById(id + '-short'); + const fullSpan = document.getElementById(id + '-full'); + const link = document.getElementById(id + '-link'); + + if (shortSpan.style.display === 'none') { + shortSpan.style.display = 'inline'; + fullSpan.style.display = 'none'; + link.textContent = lang_gen_advanced_logbook_show_more; + } else { + shortSpan.style.display = 'none'; + fullSpan.style.display = 'inline'; + link.textContent = lang_gen_advanced_logbook_show_less; + } + } From 1afebe7dec22416030bd0ef9e7de783d622d864f Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Sun, 28 Dec 2025 07:52:25 +0100 Subject: [PATCH 2/6] Added datatable to dxcc table. Added checkboxes to itu and cq --- .../views/logbookadvanced/checkresult.php | 78 ++++++++++------- .../views/logbookadvanced/dbtoolsdialog.php | 8 +- assets/js/sections/logbookadvanced.js | 84 ++++++++++++++++--- 3 files changed, 125 insertions(+), 45 deletions(-) diff --git a/application/views/logbookadvanced/checkresult.php b/application/views/logbookadvanced/checkresult.php index 5ae33b3d6..fc6856ae9 100644 --- a/application/views/logbookadvanced/checkresult.php +++ b/application/views/logbookadvanced/checkresult.php @@ -141,8 +141,8 @@ function check_dxcc($result, $custom_date_format) { ?>
- - + + @@ -158,6 +158,16 @@ function check_dxcc($result, $custom_date_format) { ?> + + + + + + + + + +
@@ -234,24 +244,27 @@ function check_incorrect_cq_zones($result, $custom_date_format) { ?> echo __("The following QSOs were found to have an incorrect CQ zone that this DXCC normally has (a maximum of 5000 QSOs are shown):"); echo ' - - - - - - - - - - - - - '; + + + + + + + + + + + + + + + '; $i = 0; foreach ($result as $qso) { - echo ''; + echo ''; + echo ''; echo ''; echo ''; echo ''; @@ -278,6 +291,7 @@ function check_incorrect_cq_zones($result, $custom_date_format) { ?> +
' . __("Date") . '' . __("Time") . '' . __("Callsign") . '' . __("Mode") . '' . __("Band") . '' . __("Gridsquare") . '' . __("CQ Zone") . '' . __("DXCC CQ Zone") . '' . __("DXCC") . '' . __("Station") . '
' . __("Date") . '' . __("Time") . '' . __("Callsign") . '' . __("Mode") . '' . __("Band") . '' . __("Gridsquare") . '' . __("CQ Zone") . '' . __("DXCC CQ Zone") . '' . __("DXCC") . '' . __("Station") . '
'; $timestamp = strtotime($qso->COL_TIME_ON); echo date($custom_date_format, $timestamp); echo ''; $timestamp = strtotime($qso->COL_TIME_ON); echo date('H:i', $timestamp); echo '' . str_replace("0","Ø",strtoupper($qso->COL_CALL)) . '
'; @@ -295,24 +309,27 @@ function check_incorrect_itu_zones($result, $custom_date_format) { ?> echo __("The following QSOs were found to have an incorrect ITU zone that this DXCC normally has (a maximum of 5000 QSOs are shown):"); echo ' - - - - - - - - - - - - - '; + + + + + + + + + + + + + + + '; $i = 0; foreach ($result as $qso) { - echo ''; + echo ''; + echo ''; echo ''; echo ''; echo ''; @@ -339,6 +356,7 @@ function check_incorrect_itu_zones($result, $custom_date_format) { ?> +
' . __("Date") . '' . __("Time") . '' . __("Callsign") . '' . __("Mode") . '' . __("Band") . '' . __("Gridsquare") . '' . __("ITU Zone") . '' . __("DXCC ITU Zone") . '' . __("DXCC") . '' . __("Station") . '
' . __("Date") . '' . __("Time") . '' . __("Callsign") . '' . __("Mode") . '' . __("Band") . '' . __("Gridsquare") . '' . __("ITU Zone") . '' . __("DXCC ITU Zone") . '' . __("DXCC") . '' . __("Station") . '
'; $timestamp = strtotime($qso->COL_TIME_ON); echo date($custom_date_format, $timestamp); echo ''; $timestamp = strtotime($qso->COL_TIME_ON); echo date('H:i', $timestamp); echo '' . str_replace("0","Ø",strtoupper($qso->COL_CALL)) . '
'; diff --git a/application/views/logbookadvanced/dbtoolsdialog.php b/application/views/logbookadvanced/dbtoolsdialog.php index e67884cee..7ace2b2d7 100644 --- a/application/views/logbookadvanced/dbtoolsdialog.php +++ b/application/views/logbookadvanced/dbtoolsdialog.php @@ -19,8 +19,8 @@
-
-

+
+

+
+ ' . __("Callsign") . ' ' . __("Date") . ' ' . __("Time") . ' - ' . __("Callsign") . ' ' . __("Mode") . ' ' . __("Band") . ' ' . __("Gridsquare") . ' @@ -274,9 +278,9 @@ function check_incorrect_cq_zones($result, $custom_date_format) { ?> foreach ($result as $qso) { echo ''; echo '
'; + echo '' . str_replace("0","Ø",strtoupper($qso->COL_CALL)) . ''; echo ''; $timestamp = strtotime($qso->COL_TIME_ON); echo date($custom_date_format, $timestamp); echo ''; echo ''; $timestamp = strtotime($qso->COL_TIME_ON); echo date('H:i', $timestamp); echo ''; - echo '' . str_replace("0","Ø",strtoupper($qso->COL_CALL)) . ''; echo ''; echo $qso->COL_SUBMODE==null?$qso->COL_MODE:$qso->COL_SUBMODE; echo ''; echo ''; if($qso->COL_SAT_NAME != null) { echo $qso->COL_SAT_NAME; } else { echo strtolower($qso->COL_BAND); }; echo ''; echo ''; echo strlen($qso->COL_GRIDSQUARE ?? '')==0?$qso->COL_VUCC_GRIDS:$qso->COL_GRIDSQUARE; echo ''; @@ -315,14 +319,18 @@ function check_incorrect_cq_zones($result, $custom_date_format) { ?> function check_incorrect_itu_zones($result, $custom_date_format) { ?>
+ echo __("The following QSOs were found to have a different ITU zone compared to what this DXCC normally has (a maximum of 5000 QSOs are shown):"); ?> +
+ +
+ ' . __("Callsign") . ' ' . __("Date") . ' ' . __("Time") . ' - ' . __("Callsign") . ' ' . __("Mode") . ' ' . __("Band") . ' ' . __("Gridsquare") . ' @@ -339,9 +347,9 @@ function check_incorrect_itu_zones($result, $custom_date_format) { ?> foreach ($result as $qso) { echo ''; echo '
'; + echo '' . str_replace("0","Ø",strtoupper($qso->COL_CALL)) . ''; echo ''; $timestamp = strtotime($qso->COL_TIME_ON); echo date($custom_date_format, $timestamp); echo ''; echo ''; $timestamp = strtotime($qso->COL_TIME_ON); echo date('H:i', $timestamp); echo ''; - echo '' . str_replace("0","Ø",strtoupper($qso->COL_CALL)) . ''; echo ''; echo $qso->COL_SUBMODE==null?$qso->COL_MODE:$qso->COL_SUBMODE; echo ''; echo ''; if($qso->COL_SAT_NAME != null) { echo $qso->COL_SAT_NAME; } else { echo strtolower($qso->COL_BAND); }; echo ''; echo ''; echo strlen($qso->COL_GRIDSQUARE ?? '')==0?$qso->COL_VUCC_GRIDS:$qso->COL_GRIDSQUARE; echo ''; diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js index e6a32df79..fa7ea301c 100644 --- a/assets/js/sections/logbookadvanced.js +++ b/assets/js/sections/logbookadvanced.js @@ -2851,3 +2851,91 @@ function saveOptions() { link.textContent = lang_gen_advanced_logbook_show_less; } } + + function fixCqZoneSelected() { + let id_list = []; + $('#incorrectcqzonetable tbody input:checked').each(function () { + let id = $(this).closest('tr').attr('id')?.replace(/\D/g, ''); + id_list.push(id); + }); + + if (id_list.length === 0) { + BootstrapDialog.alert({ + title: lang_gen_advanced_logbook_info, + message: lang_gen_advanced_logbook_select_at_least_one_row, + type: BootstrapDialog.TYPE_INFO, + closable: false, + draggable: false, + callback: function (result) { + } + }); + return; + } + + $('#fixSelectedCqZoneBtn').prop("disabled", true).addClass("running"); + $('#closeButton').prop("disabled", true); + + $.ajax({ + url: base_url + 'index.php/logbookadvanced/fixCqZones', + type: 'post', + data: {'ids': JSON.stringify(id_list, null, 2)}, + success: function(data) { + $('#fixSelectedCqZoneBtn').prop("disabled", false).removeClass("running"); + $('#closeButton').prop("disabled", false); + id_list.forEach(function(id) { + let row = $("#incorrectcqzonetable tbody tr#qsoID-" + id); + row.remove(); + }); + $('.dxcctablediv').html(data.message); + }, + error: function(xhr, status, error) { + $('#fixSelectedCqZoneBtn').prop("disabled", false).removeClass("running"); + $('#closeButton').prop("disabled", false); + $('.result').html(error); + } + }); + } + + function fixItuZoneSelected() { + let id_list = []; + $('#incorrectituzonetable tbody input:checked').each(function () { + let id = $(this).closest('tr').attr('id')?.replace(/\D/g, ''); + id_list.push(id); + }); + + if (id_list.length === 0) { + BootstrapDialog.alert({ + title: lang_gen_advanced_logbook_info, + message: lang_gen_advanced_logbook_select_at_least_one_row, + type: BootstrapDialog.TYPE_INFO, + closable: false, + draggable: false, + callback: function (result) { + } + }); + return; + } + + $('#fixSelectedItuZoneBtn').prop("disabled", true).addClass("running"); + $('#closeButton').prop("disabled", true); + + $.ajax({ + url: base_url + 'index.php/logbookadvanced/fixItuZones', + type: 'post', + data: {'ids': JSON.stringify(id_list, null, 2)}, + success: function(data) { + $('#fixSelectedItuZoneBtn').prop("disabled", false).removeClass("running"); + $('#closeButton').prop("disabled", false); + id_list.forEach(function(id) { + let row = $("#incorrectituzonetable tbody tr#qsoID-" + id); + row.remove(); + }); + $('.dxcctablediv').html(data.message); + }, + error: function(xhr, status, error) { + $('#fixSelectedItuZoneBtn').prop("disabled", false).removeClass("running"); + $('#closeButton').prop("disabled", false); + $('.result').html(error); + } + }); + } From 781385a3465c004218ac66cc94540ee089667b33 Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Mon, 29 Dec 2025 09:38:28 +0100 Subject: [PATCH 5/6] Added warning about tool --- application/views/logbookadvanced/dbtoolsdialog.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/application/views/logbookadvanced/dbtoolsdialog.php b/application/views/logbookadvanced/dbtoolsdialog.php index 7ace2b2d7..c62fe71fb 100644 --- a/application/views/logbookadvanced/dbtoolsdialog.php +++ b/application/views/logbookadvanced/dbtoolsdialog.php @@ -3,8 +3,9 @@
- +
+

From d364f2904d8ef5a0d0f0ac56dd42ecfe9451d78d Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Mon, 29 Dec 2025 09:47:56 +0100 Subject: [PATCH 6/6] Add more details in the grids vs dxcc table --- application/models/Logbookadvanced_model.php | 15 +++++++++++++-- application/views/logbookadvanced/checkresult.php | 9 +++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php index ed93ba77d..a71503a11 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -1558,7 +1558,10 @@ class Logbookadvanced_model extends CI_Model { return null; } } - + /* + * Get list of QSOs with gridsquares that do not match the gridsquares listed for the DXCC. + * The data comes from the TQSL published Gridsquare list for DXCCs. + */ public function getIncorrectGridsquares() { $sqlcheck = "select count(*) as count from vuccgrids";; $querycheck = $this->db->query($sqlcheck); @@ -1567,7 +1570,7 @@ class Logbookadvanced_model extends CI_Model { return ['status' => 'error', 'message' => __("VuccGrids table is empty. Please import the VUCC grids data first.")]; } - $sql = "select col_primary_key, col_time_on, col_call, col_band, col_gridsquare, col_dxcc, col_country, station_profile_name, + $sql = "select col_primary_key, col_time_on, col_call, col_band, col_gridsquare, col_dxcc, col_country, station_profile_name, col_lotw_qsl_rcvd, col_mode, col_submode, ( select group_concat(distinct gridsquare order by gridsquare separator ', ') from vuccgrids @@ -1855,6 +1858,10 @@ class Logbookadvanced_model extends CI_Model { return $query->result(); } + /* + Function to run batch fixes on the logbook. + Used in dbtools section. + */ function batchFix($type) { switch ($type) { case 'dxcc': @@ -1877,6 +1884,7 @@ class Logbookadvanced_model extends CI_Model { /* Another function moved from update to the advanced logbook, to be used in the dbtools section. It did not have filter on user or location. + This function will check all QSOs with missing grid square and try to fill them using the callbook lookup. */ public function check_missing_grid() { $result = $this->getMissingGridQsos(); @@ -1935,6 +1943,9 @@ class Logbookadvanced_model extends CI_Model { return $query->result(); } + /* + Check all QSOs DXCC against current DXCC database + */ public function check_dxcc() { $i = 0; diff --git a/application/views/logbookadvanced/checkresult.php b/application/views/logbookadvanced/checkresult.php index e2db1c3be..621d38cca 100644 --- a/application/views/logbookadvanced/checkresult.php +++ b/application/views/logbookadvanced/checkresult.php @@ -199,6 +199,9 @@ function check_incorrect_gridsquares($result, $custom_date_format) { ?> + + + @@ -210,6 +213,9 @@ function check_incorrect_gridsquares($result, $custom_date_format) { ?> col_primary_key . ')">' . htmlspecialchars($qso->col_call) . ''; ?> col_time_on)); ?> + col_band); ?> + col_submode ? $qso->col_submode : $qso->col_mode); ?> + col_lotw_qsl_rcvd == 'Y' ? __('Yes') : __('No'); ?> station_profile_name; ?> col_country), "- (/"), ENT_QUOTES, 'UTF-8'); ?> col_gridsquare; ?> @@ -239,6 +245,9 @@ function check_incorrect_gridsquares($result, $custom_date_format) { ?> + + +