From 4ef2237ba4d89eded45e2427d62f9305394d6a69 Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 12 Jul 2023 10:05:26 +0200 Subject: [PATCH 1/4] Base LoTW matches on time and station_callsign --- application/controllers/Lotw.php | 25 +++++++------------------ application/models/Logbook_model.php | 26 ++------------------------ 2 files changed, 9 insertions(+), 42 deletions(-) diff --git a/application/controllers/Lotw.php b/application/controllers/Lotw.php index efe12138..5c28ee1e 100644 --- a/application/controllers/Lotw.php +++ b/application/controllers/Lotw.php @@ -475,7 +475,6 @@ class Lotw extends CI_Controller { $tableheaders .= "IOTA"; $tableheaders .= "Log Status"; $tableheaders .= "LoTW Status"; - $tableheaders .= "Station ID"; $tableheaders .= ""; $table = ""; @@ -503,16 +502,12 @@ class Lotw extends CI_Controller { if($status[0] == "No Match" && $skipNewQso != NULL) { - $station_id = $this->logbook_model->find_correct_station_id($record['station_callsign'], $record['my_gridsquare']); - - if ($station_id != NULL) { - $result = $this->logbook_model->import($record, $station_id, NULL, TRUE, NULL, NULL, NULL, true, false); // Create the Entry - if ($result == "") { - $lotw_status = 'QSO imported'; - } else { - $lotw_status = $result; - } - } + $result = $this->logbook_model->import($record, $station_id, NULL, TRUE, NULL, NULL, NULL, true, false); // Create the Entry + if ($result == "") { + $lotw_status = 'QSO imported'; + } else { + $lotw_status = $result; + } } else { if (isset($record['state'])) { @@ -551,12 +546,7 @@ class Lotw extends CI_Controller { $ituz = ""; } - $station_id = $this->logbook_model->find_correct_station_id($record['station_callsign'], $record['my_gridsquare']); - if ($station_id != NULL) { - $lotw_status = $this->logbook_model->lotw_update($time_on, $record['call'], $record['band'], $qsl_date, $record['qsl_rcvd'], $state, $qsl_gridsquare, $iota, $cnty, $cqz, $ituz, $station_id); - } else { - $lotw_status = "No matching Grid/OP-Call (check Locations)"; - } + $lotw_status = $this->logbook_model->lotw_update($time_on, $record['call'], $record['band'], $qsl_date, $record['qsl_rcvd'], $state, $qsl_gridsquare, $iota, $cnty, $cqz, $ituz, $record['station_callsign']); } @@ -572,7 +562,6 @@ class Lotw extends CI_Controller { $table .= "".$iota.""; $table .= "QSO Record: ".$status[0].""; $table .= "LoTW Record: ".$lotw_status.""; - $table .= "".$station_id.""; $table .= ""; } diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 06d6d1b1..9864aea1 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -2636,7 +2636,7 @@ class Logbook_model extends CI_Model { } } - function lotw_update($datetime, $callsign, $band, $qsl_date, $qsl_status, $state, $qsl_gridsquare, $iota, $cnty, $cqz, $ituz, $station_id) { + function lotw_update($datetime, $callsign, $band, $qsl_date, $qsl_status, $state, $qsl_gridsquare, $iota, $cnty, $cqz, $ituz, $station_callsign) { $data = array( 'COL_LOTW_QSLRDATE' => $qsl_date, @@ -2665,7 +2665,7 @@ class Logbook_model extends CI_Model { $this->db->where('date_format(COL_TIME_ON, \'%Y-%m-%d %H:%i\') = "'.$datetime.'"'); $this->db->where('COL_CALL', $callsign); $this->db->where('COL_BAND', $band); - $this->db->where('station_id', $station_id); + $this->db->where('COL_STATION_CALLSIGN', $station_callsign); $this->db->update($this->config->item('table_name'), $data); unset($data); @@ -3922,28 +3922,6 @@ class Logbook_model extends CI_Model { return $query->result(); } - /* - * This function tries to locate the correct station_id used for importing QSOs from the downloaded LoTWreport - * $station_callsign is the call listed for the qso in lotwreport - * $my_gridsquare is the gridsquare listed for the qso in lotwreport - * Returns station_id if found - */ - function find_correct_station_id($station_callsign, $my_gridsquare) { - $sql = 'select station_id from station_profile - where station_callsign = "' . $station_callsign . '" and station_gridsquare = "' .$my_gridsquare. '"'; - - $query = $this->db->query($sql); - - $result = $query->row(); - - if ($result) { - return $result->station_id; - } - else { - return null; - } - } - function get_lotw_qsos_to_upload($station_id, $start_date, $end_date) { $this->db->select('COL_PRIMARY_KEY,COL_CALL, COL_BAND, COL_BAND_RX, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_SUBMODE, COL_FREQ, COL_FREQ_RX, COL_GRIDSQUARE, COL_SAT_NAME, COL_PROP_MODE, COL_LOTW_QSL_SENT, station_id'); From 5c59e9eddcd780b39d8842fc5b241375c6b17aed Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 12 Jul 2023 10:48:22 +0200 Subject: [PATCH 2/4] Remove code to auto-create QSOs upon LoTW matches --- application/controllers/Lotw.php | 18 ++++++------------ application/views/lotw/import.php | 8 -------- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/application/controllers/Lotw.php b/application/controllers/Lotw.php index 5c28ee1e..edfc6ff2 100644 --- a/application/controllers/Lotw.php +++ b/application/controllers/Lotw.php @@ -498,18 +498,8 @@ class Lotw extends CI_Controller { } $status = $this->logbook_model->import_check($time_on, $record['call'], $record['band'], $record['mode'], $record['station_callsign']); - $skipNewQso = $this->input->post('importMissing'); // If import missing was checked - if($status[0] == "No Match" && $skipNewQso != NULL) { - - $result = $this->logbook_model->import($record, $station_id, NULL, TRUE, NULL, NULL, NULL, true, false); // Create the Entry - if ($result == "") { - $lotw_status = 'QSO imported'; - } else { - $lotw_status = $result; - } - - } else { + if($status[0] == "Found") { if (isset($record['state'])) { $state = $record['state']; } else { @@ -561,7 +551,11 @@ class Lotw extends CI_Controller { $table .= "".$qsl_gridsquare.""; $table .= "".$iota.""; $table .= "QSO Record: ".$status[0].""; - $table .= "LoTW Record: ".$lotw_status.""; + if($status[0] == "Found") { + $table .= "LoTW Record: ".$lotw_status.""; + } else { + $table .= ""; + } $table .= ""; } diff --git a/application/views/lotw/import.php b/application/views/lotw/import.php index 76139dea..d76e9239 100644 --- a/application/views/lotw/import.php +++ b/application/views/lotw/import.php @@ -41,14 +41,6 @@
-

From e56694b95dbd0b459606d68dafa4d4a2dd227ce7 Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 12 Jul 2023 11:02:01 +0200 Subject: [PATCH 3/4] Remove obsolete translations --- application/language/bulgarian/lotw_lang.php | 1 - application/language/chinese_simplified/lotw_lang.php | 1 - application/language/czech/lotw_lang.php | 1 - application/language/english/lotw_lang.php | 1 - application/language/finnish/lotw_lang.php | 1 - application/language/french/lotw_lang.php | 1 - application/language/german/lotw_lang.php | 3 +-- application/language/greek/lotw_lang.php | 1 - application/language/italian/lotw_lang.php | 1 - application/language/polish/lotw_lang.php | 1 - application/language/russian/lotw_lang.php | 1 - application/language/spanish/lotw_lang.php | 1 - application/language/swedish/lotw_lang.php | 1 - application/language/turkish/lotw_lang.php | 1 - 14 files changed, 1 insertion(+), 15 deletions(-) diff --git a/application/language/bulgarian/lotw_lang.php b/application/language/bulgarian/lotw_lang.php index e70ba49c..975aa1de 100644 --- a/application/language/bulgarian/lotw_lang.php +++ b/application/language/bulgarian/lotw_lang.php @@ -31,7 +31,6 @@ $lang['lotw_upload_exported_adif_file_from_lotw'] = 'Upload the Exported ADIF fi $lang['lotw_upload_type_must_be_adi'] = 'Log files must have the file type .adi'; $lang['lotw_pull_lotw_data_for_me'] = 'Pull LoTW data for me'; -$lang['lotw_import_missing_qsos_text'] = 'Import missing QSOs into the log. Call and gridsquare will be checked to try to find the correct profile to import the QSO into. If not found, the QSO will be skipped.'; $lang['lotw_report_download_overview_helptext'] ='Cloudlog will use the LoTW username and password stored in your user profile to download a report from LoTW for you. The report Cloudlog downloads will have all confirmations since chosen date, or since your last LoTW confirmation (fetched from your log), up until now.'; diff --git a/application/language/chinese_simplified/lotw_lang.php b/application/language/chinese_simplified/lotw_lang.php index 30153d06..b1b25958 100644 --- a/application/language/chinese_simplified/lotw_lang.php +++ b/application/language/chinese_simplified/lotw_lang.php @@ -33,7 +33,6 @@ $lang['lotw_upload_exported_adif_file_from_lotw'] = '下载从 LoTW "; - $table .= "".$record['station_callsign'].""; - $table .= "".$time_on.""; - $table .= "".$record['call'].""; - $table .= "".$record['mode'].""; - $table .= "".$record['qsl_rcvd'].""; - $table .= "".$qsl_date.""; - $table .= "".$state.""; - $table .= "".$qsl_gridsquare.""; - $table .= "".$iota.""; - $table .= "QSO Record: ".$status[0].""; - if($status[0] == "Found") { + $table .= ""; + $table .= "".$record['station_callsign'].""; + $table .= "".$time_on.""; + $table .= "".$record['call'].""; + $table .= "".$record['mode'].""; + $table .= "".$record['qsl_rcvd'].""; + $table .= "".$qsl_date.""; + $table .= "".$state.""; + $table .= "".$qsl_gridsquare.""; + $table .= "".$iota.""; + $table .= "QSO Record: ".$status[0].""; $table .= "LoTW Record: ".$lotw_status.""; - } else { + $table .= ""; + } else { + $table .= ""; + $table .= "".$record['station_callsign'].""; + $table .= "".$time_on.""; + $table .= "".$record['call'].""; + $table .= "".$record['mode'].""; + $table .= "".$record['qsl_rcvd'].""; $table .= ""; - } - $table .= ""; + $table .= ""; + $table .= ""; + $table .= ""; + $table .= "QSO Record: ".$status[0].""; + $table .= ""; + $table .= ""; + } } if ($table != "")