[ADIF Import] Catch when RX_PWR is not a number and error out

If RX_POWER is not a number or K or KW then set the value to null and show error.

Fixes #2983
pull/2998/head
Peter Goodhall 2024-02-26 16:00:07 +00:00
rodzic 94f3ebf53d
commit aac251d251
1 zmienionych plików z 13 dodań i 5 usunięć

Wyświetl plik

@ -2984,7 +2984,8 @@ class Logbook_model extends CI_Model
}
/* Used to check if the qso is already in the database */
function import_check($datetime, $callsign, $band, $mode, $station_callsign, $station_id = null) {
function import_check($datetime, $callsign, $band, $mode, $station_callsign, $station_id = null)
{
$mode = $this->get_main_mode_from_mode($mode);
$this->db->select('COL_PRIMARY_KEY, COL_TIME_ON, COL_CALL, COL_BAND');
@ -3412,8 +3413,15 @@ class Logbook_model extends CI_Model
// Check if RX_PWR is "K" which N1MM+ uses to indicate 1000W
if ($record['rx_pwr'] == "K") {
$rx_pwr = 1000;
} elseif ($record['rx_pwr'] == "KW") {
$rx_pwr = 1000;
} else {
$rx_pwr = filter_var($record['rx_pwr'], FILTER_VALIDATE_FLOAT);
if (isset($record['rx_pwr']) && is_numeric($record['rx_pwr'])) {
$rx_pwr = $record['rx_pwr'];
} else {
$rx_pwr = null;
$my_error .= "Error QSO: Date: " . $time_on . " Callsign: " . $record['call'] . " RX_PWR (".$record['rx_pwr'].") is not a number<br>";
}
}
} else {
$rx_pwr = NULL;