From 06656bfef81fa9234f2e296950e48f514ec1dec1 Mon Sep 17 00:00:00 2001 From: int2001 Date: Sun, 2 Jul 2023 17:13:30 +0200 Subject: [PATCH] Fixes the LotW-Part of Bug #2238. LotW-Import now takes care of station_id (operator-call and gridsquare) --- application/controllers/Lotw.php | 7 ++++++- application/models/Logbook_model.php | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/application/controllers/Lotw.php b/application/controllers/Lotw.php index eb00dd44..99ea338e 100644 --- a/application/controllers/Lotw.php +++ b/application/controllers/Lotw.php @@ -550,7 +550,12 @@ class Lotw extends CI_Controller { $ituz = ""; } - $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 = $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)"; + } } diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 71e7ac28..fef892d9 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -2488,7 +2488,7 @@ class Logbook_model extends CI_Model { } } - function lotw_update($datetime, $callsign, $band, $qsl_date, $qsl_status, $state, $qsl_gridsquare, $iota, $cnty, $cqz, $ituz) { + function lotw_update($datetime, $callsign, $band, $qsl_date, $qsl_status, $state, $qsl_gridsquare, $iota, $cnty, $cqz, $ituz, $station_id) { $data = array( 'COL_LOTW_QSLRDATE' => $qsl_date, @@ -2517,6 +2517,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->update($this->config->item('table_name'), $data); unset($data);