From 42e63e1a1680ab0723a99423088859ec80461cf5 Mon Sep 17 00:00:00 2001
From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com>
Date: Thu, 25 Dec 2025 18:20:05 +0100
Subject: [PATCH] Update works
---
application/controllers/Logbookadvanced.php | 13 ++++
application/models/Logbookadvanced_model.php | 31 +++++++-
.../views/logbookadvanced/checkresult.php | 58 ++++++++-------
.../views/logbookadvanced/dbtoolsdialog.php | 3 +-
assets/js/sections/logbookadvanced.js | 72 +++++++++++++++++++
5 files changed, 149 insertions(+), 28 deletions(-)
diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php
index e19768668..0cd00b110 100644
--- a/application/controllers/Logbookadvanced.php
+++ b/application/controllers/Logbookadvanced.php
@@ -992,4 +992,17 @@ class Logbookadvanced extends CI_Controller {
$this->load->view('logbookadvanced/dupesearchdialog');
}
+ function fixDxccSelected() {
+ if(!clubaccess_check(9)) return;
+
+ $ids = xss_clean($this->input->post('ids'));
+
+ $this->load->model('logbookadvanced_model');
+ $result = $this->logbookadvanced_model->fixDxccSelected($ids);
+ $result['message'] = '
' . sprintf(__("DXCC updated for %d QSO(s)."), $result['count']) . '
';
+
+ header("Content-Type: application/json");
+ print json_encode($result);
+ }
+
}
diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php
index aacc09b23..a2a05b5d5 100644
--- a/application/models/Logbookadvanced_model.php
+++ b/application/models/Logbookadvanced_model.php
@@ -1905,7 +1905,6 @@ class Logbookadvanced_model extends CI_Model {
foreach ($callarray->result() as $call) {
$i++;
- //$dxcc = $this->logbook_model->dxcc_lookup($call->col_call, $call->date);
$dxcc = $dxccobj->dxcc_lookup($call->col_call, $call->date);
$dxcc['adif'] = (isset($dxcc['adif'])) ? $dxcc['adif'] : 0;
@@ -1951,4 +1950,34 @@ class Logbookadvanced_model extends CI_Model {
return $query;
}
+
+ function fixDxccSelected($ids) {
+ $sql = "select COL_PRIMARY_KEY, COL_CALL, COL_TIME_ON, COL_TIME_OFF, station_profile.station_profile_name from " . $this->config->item('table_name') .
+ " join station_profile on " . $this->config->item('table_name') . ".station_id = station_profile.station_id
+ where station_profile.user_id = ? and " . $this->config->item('table_name') . ".col_primary_key in ?";
+
+ $r = $this->db->query($sql, array($this->session->userdata('user_id'), json_decode($ids, true)));
+
+ $count = 0;
+ $dxccobj = new Dxcc(null);
+
+ if ($r->num_rows() > 0) { //query dxcc_prefixes
+ $sql = "update " . $this->config->item('table_name') . " set COL_COUNTRY = ?, COL_DXCC = ? where COL_PRIMARY_KEY = ?";
+ $q = $this->db->conn_id->prepare($sql);
+ foreach ($r->result_array() as $row) {
+ $qso_date = $row['COL_TIME_OFF'] == '' ? $row['COL_TIME_ON'] : $row['COL_TIME_OFF'];
+ $qso_date = date("Y-m-d", strtotime($qso_date));
+ $dxcc = $dxccobj->dxcc_lookup($row['COL_CALL'], $qso_date);
+ $dxcc['adif'] = (isset($dxcc['adif'])) ? $dxcc['adif'] : 0;
+ $dxcc['entity'] = (isset($dxcc['entity'])) ? $dxcc['entity'] : 'None';
+ if ($dxcc['adif'] != 'Not Found') {
+ $q->execute(array(addslashes(ucwords(strtolower($dxcc['entity']), "- (/")), $dxcc['adif'], $row['COL_PRIMARY_KEY']));
+ $count++;
+ }
+ }
+ }
+
+ $result['count'] = $count;
+ return $result;
+ }
}
diff --git a/application/views/logbookadvanced/checkresult.php b/application/views/logbookadvanced/checkresult.php
index 8cfca38a4..a7ce37d6b 100644
--- a/application/views/logbookadvanced/checkresult.php
+++ b/application/views/logbookadvanced/checkresult.php
@@ -114,35 +114,43 @@ function check_missing_grids($result) { ?>
function check_dxcc($result, $custom_date_format) { ?>
= __("DXCC Check Results") ?>
" . __("Callsigns tested: ") . $result['calls_tested'] . "";
- echo "" . __("Execution time: ") . round($result['execution_time'], 2) . "s
";
- echo "" . __("Number of potential QSOs with wrong DXCC: ") . count($result['result']) . "
";
+ echo __("Callsigns tested: ") . $result['calls_tested'] . ".
";
+ echo __("Execution time: ") . round($result['execution_time'], 2) . "s.
";
+ echo __("Number of potential QSOs with wrong DXCC: ") . count($result['result']);
if ($result) { ?>
-
-
-
-
- | = __("Callsign"); ?> |
- = __("QSO Date"); ?> |
- = __("Station Profile"); ?> |
- = __("Existing DXCC"); ?> |
- = __("Result DXCC"); ?> |
-
-
-
-
+
+
+
+
+
+
+
+
+
+ |
+ ' . htmlspecialchars($qso['callsign']) . ''; ?> |
+ |
+ |
+ |
+ |
+
+
+
+
+
-
= __("Re-check DXCC for all QSOs in the logbook") ?>
+
= __("Check all QSOs in the logbook for incorrect DXCC") ?>
= __("Use Wavelog to determine DXCC for all QSOs.") ?>
-
= __("This will overwrite ALL existing DXCC information!") ?>