Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
969b079
[Advanced Logbook] Started on dbtools
AndreasK79 Dec 2, 2025
24672dd
Merge branch 'dev' into lba_db_tools
AndreasK79 Dec 7, 2025
cdf942d
Tweaked layout a bit and implemented checks for continent/dxcc/distance
AndreasK79 Dec 7, 2025
2ddf698
Added state check
AndreasK79 Dec 7, 2025
0fad755
Implemented batch state fixer
AndreasK79 Dec 7, 2025
46fad66
Added button to show qso list in state
AndreasK79 Dec 7, 2025
10c5a0a
Fix QSO list. Added info to info button
AndreasK79 Dec 8, 2025
6933a63
Moved DXCC QSO updater from update to lba
AndreasK79 Dec 8, 2025
bde29d6
Add userid filter
AndreasK79 Dec 8, 2025
7e3b962
Get dxcc fix working in gui
AndreasK79 Dec 8, 2025
462664f
Use html view to load result instead
AndreasK79 Dec 8, 2025
e219425
Added Run buttons
AndreasK79 Dec 8, 2025
c2948a3
Merge branch 'dev' into lba_db_tools
AndreasK79 Dec 8, 2025
b49bfcf
Corrected number of counties
AndreasK79 Dec 8, 2025
6f9f0fa
Added state and callsign link in state qso list
AndreasK79 Dec 10, 2025
b72d9c9
Fixed DXCC checking for ALL QSOs
AndreasK79 Dec 11, 2025
7117a10
Fix updating missing DXCC
AndreasK79 Dec 12, 2025
dc9a7ad
Add QSO list for missing DXCC
AndreasK79 Dec 13, 2025
3d0949c
Added changed files
AndreasK79 Dec 13, 2025
82fbbb8
Continent update is fixed
AndreasK79 Dec 13, 2025
b70c128
Fixed CQ/ITU zone updater
AndreasK79 Dec 14, 2025
99c2d05
Changed wording a bit
AndreasK79 Dec 14, 2025
d390f2d
Fixed some ids to have spinner working
AndreasK79 Dec 14, 2025
91cdec2
Moved function from model, and added userid
AndreasK79 Dec 14, 2025
539ee16
Merge branch 'dev' into lba_db_tools
AndreasK79 Dec 14, 2025
00b5397
Adding translations
AndreasK79 Dec 14, 2025
d16ff05
Removed information in dialog, and instead linked to the Wiki
AndreasK79 Dec 14, 2025
27f9cb9
Changed to button
AndreasK79 Dec 14, 2025
e4721c1
Fixed state update count
AndreasK79 Dec 14, 2025
6a746b6
Red if 0, green if > 0
AndreasK79 Dec 15, 2025
9d29f7e
Fixed return messages for dxcc update
AndreasK79 Dec 15, 2025
90daf3a
More verbose message on dxcc and state fixer
AndreasK79 Dec 15, 2025
fc1993b
Fix disabled close button
AndreasK79 Dec 15, 2025
325ada1
Fixed continent return result
AndreasK79 Dec 15, 2025
decc5f7
Fixed distance return result
AndreasK79 Dec 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[Advanced Logbook] Started on dbtools
  • Loading branch information
AndreasK79 committed Dec 2, 2025
commit 969b079ae7848d26bc4f4d96c3bdef06b4db71a9
15 changes: 15 additions & 0 deletions application/controllers/Logbookadvanced.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
15 changes: 15 additions & 0 deletions application/models/Logbookadvanced_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
117 changes: 117 additions & 0 deletions application/views/logbookadvanced/dbtoolsdialog.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<div class="container">
<div class="row">
<div class="col-md-6">
<h5><?= __("Data Repair Tools") ?></h5>
<div class="list-group">
<div class="list-group-item d-flex justify-content-between align-items-center">
<div>
<h6 class="mb-1"><?= __("Fix CQ Zones") ?></h6>
<p class="mb-1 small text-muted"><?= __("Update missing or incorrect CQ zone information") ?></p>
</div>
<div class="d-flex nowrap">
<button type="button" class="btn btn-sm btn-secondary me-1" id="checkFixCqZonesBtn" onclick="checkFixCqZones()">
<?= __("Check") ?>
</button>
<button type="button" class="btn btn-sm btn-primary" id="fixCqZonesBtn" onclick="runFixCqZones()">
<?= __("Run") ?>
</button>
</div>
</div>

<div class="list-group-item d-flex justify-content-between align-items-center">
<div>
<h6 class="mb-1"><?= __("Fix ITU Zones") ?></h6>
<p class="mb-1 small text-muted"><?= __("Update missing or incorrect ITU zone information") ?></p>
</div>
<div class="d-flex nowrap">
<button type="button" class="btn btn-sm btn-secondary me-1" id="checkFixItuZonesBtn" onclick="checkFixItuZones()">
<?= __("Check") ?>
</button>
<button type="button" class="btn btn-sm btn-primary" id="fixItuZonesBtn" onclick="runFixItuZones()">
<?= __("Run") ?>
</button>
</div>
</div>

<div class="list-group-item d-flex justify-content-between align-items-center">
<div>
<h6 class="mb-1"><?= __("Fix Continent") ?></h6>
<p class="mb-1 small text-muted"><?= __("Update missing or incorrect continent information") ?></p>
</div>
<div class="d-flex nowrap">
<button type="button" class="btn btn-sm btn-secondary me-1" id="checkFixContinentBtn" onclick="checkFixContinent()">
<?= __("Check") ?>
</button>
<button type="button" class="btn btn-sm btn-primary" id="fixContinentBtn" onclick="runFixContinent()">
<?= __("Run") ?>
</button>
</div>
</div>

<div class="list-group-item d-flex justify-content-between align-items-center">
<div>
<h6 class="mb-1"><?= __("Fix State") ?></h6>
<p class="mb-1 small text-muted"><?= __("Update missing or incorrect state/province information") ?></p>
</div>
<div class="d-flex nowrap">
<button type="button" class="btn btn-sm btn-secondary me-1" id="checkFixStateBtn" onclick="checkFixState()">
<?= __("Check") ?>
</button>
<button type="button" class="btn btn-sm btn-primary" id="fixStateBtn" onclick="runFixState()">
<?= __("Run") ?>
</button>
</div>
</div>

<div class="list-group-item d-flex justify-content-between align-items-center">
<div>
<h6 class="mb-1"><?= __("Update Distances") ?></h6>
<p class="mb-1 small text-muted"><?= __("Calculate and update distance information for QSOs") ?></p>
</div>
<div class="d-flex nowrap">
<button type="button" class="btn btn-sm btn-secondary me-1" id="checkUpdateDistancesBtn" onclick="checkUpdateDistances()">
<?= __("Check") ?>
</button>
<button type="button" class="btn btn-sm btn-primary" id="updateDistancesBtn" onclick="runUpdateDistances()">
<?= __("Run") ?>
</button>
</div>
</div>

<div class="list-group-item d-flex justify-content-between align-items-center">
<div>
<h6 class="mb-1"><?= __("Check QSOs missing DXCC data") ?></h6>
<p class="mb-1 small text-muted"><?= __("Identify QSOs that are missing DXCC information") ?></p>
</div>
<div class="d-flex nowrap">
<button type="button" class="btn btn-sm btn-secondary me-1" id="checkUpdateDistancesBtn" onclick="checkUpdateDistances()">
<?= __("Check") ?>
</button>
<button type="button" class="btn btn-sm btn-primary" id="updateDistancesBtn" onclick="runUpdateDistances()">
<?= __("Run") ?>
</button>
</div>
</div>

<div class="list-group-item d-flex justify-content-between align-items-center">
<div>
<h6 class="mb-1"><?= __("Re-check DXCC for all QSOs in the logbook") ?></h6>
<p class="mb-1 small text-muted"><?= __("Use Wavelog to determine DXCC for all QSOs. This will overwrite existing DXCC information.") ?></p>
</div>
<div class="d-flex nowrap">
<button type="button" class="btn btn-sm btn-secondary me-1" id="checkUpdateDistancesBtn" onclick="checkUpdateDistances()">
<?= __("Check") ?>
</button>
<button type="button" class="btn btn-sm btn-primary" id="updateDistancesBtn" onclick="runUpdateDistances()">
<?= __("Run") ?>
</button>
</div>
</div>

</div>
</div>
<div class="col-md-6 result"></div>


</div>
</div>
1 change: 1 addition & 0 deletions application/views/logbookadvanced/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,7 @@
<button type="button" class="btn btn-sm btn-success dropdown-action" id="fixContinent"><?= __("Fix Continent"); ?></button>
<button type="button" class="btn btn-sm btn-success dropdown-action" id="fixState"><?= __("Fix State"); ?></button>
<button type="button" class="btn btn-sm btn-success dropdown-action" id="updateDistances"><?= __("Update Distances"); ?></button>
<button type="button" class="btn btn-sm btn-success dropdown-action" id="dbtools"><?= __("Database Tools"); ?></button>
</div>
</div>
</div>
Expand Down
65 changes: 65 additions & 0 deletions assets/js/sections/logbookadvanced.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 = '<h6>Distance Check Results</h6>';
resultHtml += '<p><strong>QSO to update found:</strong> ' + (response[0].count) + '</p>';

$('.result').html(resultHtml);
},
error: function(xhr, status, error) {
$('#checkUpdateDistancesBtn').prop('disabled', false).text('<?= __("Check") ?>');
$('#closeButton').prop('disabled', false);

let errorMsg = '<?= __("Error checking distance information") ?>';
if (xhr.responseJSON && xhr.responseJSON.message) {
errorMsg += ': ' + xhr.responseJSON.message;
}

BootstrapDialog.alert({
title: '<?= __("Error") ?>',
message: errorMsg,
type: BootstrapDialog.TYPE_DANGER
});
}
});


}