From 7117a1095a1d9e18580f85b25e63dd6639827e2a Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Fri, 12 Dec 2025 09:45:51 +0100 Subject: [PATCH] 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 f343a180c..d1fbf2884 100644 --- a/application/controllers/Logbookadvanced.php +++ b/application/controllers/Logbookadvanced.php @@ -945,6 +945,10 @@ class Logbookadvanced extends CI_Controller { $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 fa2b1707e..21881dcc6 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -1605,7 +1605,7 @@ class Logbookadvanced_model extends CI_Model { $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 73d4f7a05..7e4bf0e92 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 e366fa0d9..a310f85fd 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); + } + }) + } }