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 7900a6ca..3a644f29 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);