Merge pull request #2741 from phl0/updateOnlySingleItuZones

Auto update only for single ITU zones
This commit is contained in:
Andreas Kristiansen
2025-12-31 13:15:20 +01:00
committed by GitHub
4 changed files with 25 additions and 33 deletions

View File

@@ -329,7 +329,14 @@ function check_incorrect_itu_zones($result, $custom_date_format) { ?>
<h5><?= __("ITU Zone Check Results") ?></h5>
<?php if ($result) {
echo __("The following QSOs were found to have a different ITU 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="forceMultiZoneUpdate" />
<?= __("Force update even if DXCC covers multiple ITU zones") ?>
<div class="d-block mb-1 alert-danger"><?= __("The update function can only set the main ITU zone which is assigned to the DXCC. If the DXCC covers multiple ITU zones there is a chance that this is not correct. So by default only QSOs with DXCCs covering a single ITU 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="fixSelectedItuZoneBtn" onclick="fixItuZoneSelected(true)">
<?= __("Update selected") ?><div class="ld ld-ring ld-spin"></div>
</button>
@@ -363,7 +370,7 @@ function check_incorrect_itu_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_ITUZ . '</td>';
echo '<td style=\'text-align: center\'>' . $qso->correctituzone . '</td>';
echo '<td id=\'ituZones\' style=\'text-align: center\'>' . $qso->correctituzone . '</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>';

View File

@@ -7,17 +7,6 @@
</h5>
<p class="mb-1 alert-danger"><?= __("Warning. This tool can be dangerous to your data, and should only be used if you know what you are doing.") ?></p>
<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 CQ zone information") ?></p>
</div>
<div class="d-flex nowrap">
<button type="button" class="btn btn-sm btn-success me-1 ld-ext-right" id="checkFixCqZonesBtn" onclick="checkFixCqZones()">
<?= __("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 CQ Zones") ?></h6>
@@ -29,19 +18,6 @@
</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 ITU zone information") ?></p>
</div>
<div class="d-flex nowrap">
<button type="button" class="btn btn-sm btn-success me-1 ld-ext-right" id="checkFixItuZonesBtn" onclick="checkFixItuZones()">
<?= __("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 ITU Zones") ?></h6>
@@ -53,8 +29,7 @@
</button>
</div>
</div>
<div class="list-group-item d-flex justify-content-between align-items-center">
<div class="list-group-item d-flex justify-content-between align-items-center">
<div>
<h6 class="mb-1"><?= __("Check Gridsquares") ?></h6>
<p class="mb-1 small text-muted"><?= __("Check gridsquares that does not match the DXCC") ?></p>

View File

@@ -793,8 +793,6 @@ $options = json_decode($options);
<button type="button" class="btn btn-sm btn-info dropdown-action" id="exportAdif"><?= __("Create ADIF"); ?></button>
<button type="button" class="btn btn-sm btn-info dropdown-action" id="printLabel"><?= __("Print Label"); ?></button>
<button type="button" class="btn btn-sm btn-info dropdown-action" id="qslSlideshow"><?= __("QSL Slideshow"); ?></button>
<button type="button" class="btn btn-sm btn-success dropdown-action" id="fixCqZones"><?= __("Fix CQ Zones"); ?></button>
<button type="button" class="btn btn-sm btn-success dropdown-action" id="fixItuZones"><?= __("Fix ITU Zones"); ?></button>
<button type="button" class="btn btn-sm btn-success dropdown-action" id="fixState"><?= __("Fix State"); ?></button>
</div>
</div>

View File

@@ -2725,12 +2725,18 @@ function saveOptions() {
$('#checkBoxAllItuZones').change(function (event) {
if (this.checked) {
$('#incorrectituzonetable tbody tr').each(function (i) {
selectQsoIdDxcc($(this).first().closest('tr').attr('id')?.replace(/\D/g, ''), 'incorrectituzonetable');
if (!$(this).first().closest('tr').find("td[id='ituZones']").text().includes(',') || $('#forceMultiZoneUpdate').prop("checked")) {
selectQsoIdDxcc($(this).first().closest('tr').attr('id')?.replace(/\D/g, ''), 'incorrectituzonetable');
}
});
if (!$('#forceMultiZoneUpdate').prop("checked")) {
$('#incorrectituzonetable').DataTable().column(8).search('^[^,]*$', true, false).draw();
}
} else {
$('#incorrectituzonetable tbody tr').each(function (i) {
unselectQsoIdDxcc($(this).first().closest('tr').attr('id')?.replace(/\D/g, ''), 'incorrectituzonetable');
});
$('#incorrectituzonetable').DataTable().column(8).search('').draw();
}
});
}
@@ -2900,7 +2906,10 @@ function saveOptions() {
let id_list = [];
$('#incorrectituzonetable 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 ITU zones as the matching one cannot be identified automagically atm or force update
if (!$(this).closest('tr').find("td[id='ituZones']").text().includes(',') || $('#forceMultiZoneUpdate').prop("checked")) {
id_list.push(id);
}
});
if (id_list.length === 0) {
@@ -2916,6 +2925,8 @@ function saveOptions() {
return;
}
let table = $('#incorrectituzonetable').DataTable();
$('#fixSelectedItuZoneBtn').prop("disabled", true).addClass("running");
$('#closeButton').prop("disabled", true);
@@ -2928,7 +2939,8 @@ function saveOptions() {
$('#closeButton').prop("disabled", false);
id_list.forEach(function(id) {
let row = $("#incorrectituzonetable tbody tr#qsoID-" + id);
row.remove();
table.row(row).remove();
table.draw(false);
});
$('.dxcctablediv').html(data.message);
},