Merge pull request #2744 from AndreasK79/dbtools_another_round_with_fixes

This commit is contained in:
Andreas Kristiansen
2025-12-31 15:31:45 +01:00
committed by GitHub
4 changed files with 45 additions and 25 deletions

View File

@@ -2042,7 +2042,7 @@ class Logbookadvanced_model extends CI_Model {
$dxcc['adif'] = (isset($dxcc['adif'])) ? $dxcc['adif'] : 0;
$dxcc['entity'] = (isset($dxcc['entity'])) ? $dxcc['entity'] : 'None';
if ($call->col_dxcc != $dxcc['adif']) {
if (($call->col_dxcc ?? 'Unset') != $dxcc['adif']) {
$result[] = array(
'callsign' => $call->col_call,
'qso_date' => $call->date,

View File

@@ -260,7 +260,14 @@ function check_incorrect_cq_zones($result, $custom_date_format) { ?>
<h5><?= __("CQ Zone Check Results") ?></h5>
<?php if ($result) {
echo __("The following QSOs were found to have a different CQ zone compared to what this DXCC normally has (a maximum of 5000 QSOs are shown):"); ?>
<br />
<br /><br />
<div class="col-md-12">
<div class="form-check form-check-lg border rounded p-3 bg-light h-100">
<input class="form-check-input me-2" type="checkbox" id="forceMultiZoneUpdateCq" />
<?= __("Force update even if DXCC covers multiple CQ zones") ?>
<div class="d-block mb-1 alert-danger"><?= __("The update function can only set the main CQ zone which is assigned to the DXCC. If the DXCC covers multiple CQ zones there is a chance that this is not correct. So by default only QSOs with DXCCs covering a single CQ zone are updated. This checkbox overrides this but might result in wrong data. Use with caution!"); ?></div>
</div>
</div>
<button type="button" class="mt-2 mb-2 btn btn-sm btn-primary ld-ext-right" id="fixSelectedCqZoneBtn" onclick="fixCqZoneSelected(true)">
<?= __("Update selected") ?><div class="ld ld-ring ld-spin"></div>
</button>
@@ -274,7 +281,7 @@ function check_incorrect_cq_zones($result, $custom_date_format) { ?>
<th style=\'text-align: center\'>' . __("Mode") . '</th>
<th style=\'text-align: center\'>' . __("Band") . '</th>
<th style=\'text-align: center\'>' . __("Gridsquare") . '</th>
<th style=\'text-align: center\'>' . __("CQ Zone") . '</th>
<th style=\'text-align: center\' class="select-filter" scope="col">' . __("CQ Zone") . '</th>
<th style=\'text-align: center\'>' . __("DXCC CQ Zone") . '</th>
<th style=\'text-align: center\' class="select-filter" scope="col">' . __("DXCC") . '</th>
<th style=\'text-align: center\' class="select-filter" scope="col">' . __("Station") . '</th>
@@ -294,7 +301,7 @@ function check_incorrect_cq_zones($result, $custom_date_format) { ?>
echo '<td style=\'text-align: center\'>'; if($qso->COL_SAT_NAME != null) { echo $qso->COL_SAT_NAME; } else { echo strtolower($qso->COL_BAND); }; echo '</td>';
echo '<td style=\'text-align: center\'>'; echo strlen($qso->COL_GRIDSQUARE ?? '')==0?$qso->COL_VUCC_GRIDS:$qso->COL_GRIDSQUARE; echo '</td>';
echo '<td style=\'text-align: center\'>' . $qso->COL_CQZ . '</td>';
echo '<td style=\'text-align: center\'>' . $qso->correctcqzone . '</td>';
echo '<td id=\'cqZones\' style=\'text-align: center\'>' . $qso->correctcqzone . '</td>';
echo '<td style=\'text-align: center\'>' . ucwords(strtolower($qso->COL_COUNTRY), "- (/") . '</td>';
echo '<td style=\'text-align: center\'>' . $qso->station_profile_name . '</td>';
echo '</tr>';
@@ -350,7 +357,7 @@ function check_incorrect_itu_zones($result, $custom_date_format) { ?>
<th style=\'text-align: center\'>' . __("Mode") . '</th>
<th style=\'text-align: center\'>' . __("Band") . '</th>
<th style=\'text-align: center\'>' . __("Gridsquare") . '</th>
<th style=\'text-align: center\'>' . __("ITU Zone") . '</th>
<th style=\'text-align: center\' class="select-filter" scope="col">' . __("ITU Zone") . '</th>
<th style=\'text-align: center\'>' . __("DXCC ITU Zone") . '</th>
<th style=\'text-align: center\' class="select-filter" scope="col">' . __("DXCC") . '</th>
<th style=\'text-align: center\' class="select-filter" scope="col">' . __("Station") . '</th>

View File

@@ -40,7 +40,6 @@
</button>
</div>
</div>
<div class="list-group-item d-flex justify-content-between align-items-center">
<div>
<h6 class="mb-1"><?= __("Fix Continent") ?></h6>
@@ -52,7 +51,6 @@
</button>
</div>
</div>
<div class="list-group-item d-flex justify-content-between align-items-center">
<div>
<h6 class="mb-1"><?= __("Fix State") ?></h6>
@@ -64,7 +62,6 @@
</button>
</div>
</div>
<div class="list-group-item d-flex justify-content-between align-items-center">
<div>
<h6 class="mb-1"><?= __("Update Distances") ?></h6>
@@ -76,19 +73,6 @@
</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-success me-1 ld-ext-right" id="checkMissingDxccsBtn" onclick="checkMissingDxcc()">
<?= __("Check") ?><div class="ld ld-ring ld-spin"></div>
</button>
</div>
</div>
<div class="list-group-item d-flex justify-content-between align-items-center">
<div>
<h6 class="mb-1"><?= __("Check all QSOs in the logbook for incorrect DXCC") ?></h6>

View File

@@ -2611,6 +2611,13 @@ function saveOptions() {
});
});
rebind_checkbox_trigger_cq_zone();
$('#forceMultiZoneUpdateCq').on('change', function() {
$('#incorrectcqzonetable').DataTable().column(8).search('').draw();
$('#checkBoxAllCqZones').prop('checked', false);
$('#incorrectcqzonetable tbody input[type="checkbox"]').prop('checked', false);
$('#incorrectcqzonetable tbody tr.activeRow').removeClass('activeRow');
});
},
});
},
@@ -2672,6 +2679,13 @@ function saveOptions() {
},
});
$('#forceMultiZoneUpdate').on('change', function() {
$('#incorrectituzonetable').DataTable().column(8).search('').draw();
$('#checkBoxAllItuZones').prop('checked', false);
$('#incorrectituzonetable tbody input[type="checkbox"]').prop('checked', false);
$('#incorrectituzonetable tbody tr.activeRow').removeClass('activeRow');
});
},
error: function(xhr, status, error) {
$('#checkIncorrectItuZonesBtn').prop("disabled", false).removeClass("running");
@@ -2711,12 +2725,18 @@ function saveOptions() {
$('#checkBoxAllCqZones').change(function (event) {
if (this.checked) {
$('#incorrectcqzonetable tbody tr').each(function (i) {
selectQsoIdDxcc($(this).first().closest('tr').attr('id')?.replace(/\D/g, ''), 'incorrectcqzonetable');
if (!$(this).first().closest('tr').find("td[id='cqZones']").text().includes(',') || $('#forceMultiZoneUpdateCq').prop("checked")) {
selectQsoIdDxcc($(this).first().closest('tr').attr('id')?.replace(/\D/g, ''), 'incorrectcqzonetable');
}
});
if (!$('#forceMultiZoneUpdateCq').prop("checked")) {
$('#incorrectcqzonetable').DataTable().column(8).search('^[^,]*$', true, false).draw();
}
} else {
$('#incorrectcqzonetable tbody tr').each(function (i) {
unselectQsoIdDxcc($(this).first().closest('tr').attr('id')?.replace(/\D/g, ''), 'incorrectcqzonetable');
});
$('#incorrectcqzonetable').DataTable().column(8).search('').draw();
}
});
}
@@ -2761,6 +2781,8 @@ function saveOptions() {
return;
}
let table = $('#dxccCheckTable').DataTable();
$('#fixSelectedDxccBtn').prop("disabled", true).addClass("running");
$('#closeButton').prop("disabled", true);
@@ -2773,7 +2795,8 @@ function saveOptions() {
$('#closeButton').prop("disabled", false);
id_list.forEach(function(id) {
let row = $("#dxccCheckTable tbody tr#qsoID-" + id);
row.remove();
table.row(row).remove();
table.draw(false);
});
$('.dxcctablediv').html(data.message);
},
@@ -2862,7 +2885,10 @@ function saveOptions() {
let id_list = [];
$('#incorrectcqzonetable tbody input:checked').each(function () {
let id = $(this).closest('tr').attr('id')?.replace(/\D/g, '');
id_list.push(id);
// Skip entry if DXCC covers multiple CQ zones as the matching one cannot be identified automagically atm or force update
if (!$(this).closest('tr').find("td[id='cqZones']").text().includes(',') || $('#forceMultiZoneUpdate').prop("checked")) {
id_list.push(id);
}
});
if (id_list.length === 0) {
@@ -2878,6 +2904,8 @@ function saveOptions() {
return;
}
let table = $('#incorrectcqzonetable').DataTable();
$('#fixSelectedCqZoneBtn').prop("disabled", true).addClass("running");
$('#closeButton').prop("disabled", true);
@@ -2890,7 +2918,8 @@ function saveOptions() {
$('#closeButton').prop("disabled", false);
id_list.forEach(function(id) {
let row = $("#incorrectcqzonetable tbody tr#qsoID-" + id);
row.remove();
table.row(row).remove();
table.draw(false);
});
$('.dxcctablediv').html(data.message);
},