Fix updating missing DXCC

This commit is contained in:
Andreas Kristiansen
2025-12-12 09:45:51 +01:00
parent b72d9c9348
commit 7117a1095a
5 changed files with 64 additions and 35 deletions

View File

@@ -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);
}
}
}

View File

@@ -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 = ''");

View File

@@ -42,7 +42,7 @@ function check_missing_dxcc($result) { ?>
<h5>DXCC Check Results</h5>
QSOs to update found: <?php echo $result[0]->count; ?>
<br/>
<button type="button" class="mt-2 btn btn-sm btn-primary ld-ext-right" id="updateDistancesBtn" onclick="fixMissingDxcc('All')">
<button type="button" class="mt-2 btn btn-sm btn-primary ld-ext-right" id="fixMissingDxccBtn" onclick="fixMissingDxcc(false)">
<?= __("Run fix") ?><div class="ld ld-ring ld-spin"></div>
</button>
<?php }

View File

@@ -86,7 +86,7 @@
<p class="mb-1 small alert-danger"><?= __("This will overwrite ALL existing DXCC information!") ?></p>
</div>
<div class="d-flex nowrap">
<button type="button" class="btn btn-sm btn-primary ld-ext-right" id="updateDxccBtn" onclick="fixMissingDxcc('All')">
<button type="button" class="btn btn-sm btn-primary ld-ext-right" id="updateDxccBtn" onclick="fixMissingDxcc(true)">
<?= __("Run") ?><div class="ld ld-ring ld-spin"></div>
</button>
</div>

View File

@@ -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);
}
})
}
}