From 02358164126b690281c994bb135bf192c52c2285 Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Sat, 15 Jun 2024 00:09:11 +0200 Subject: [PATCH] use primary key for QSO instead searching for it again --- application/controllers/Qrz.php | 4 ++-- application/models/Logbook_model.php | 7 ++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/application/controllers/Qrz.php b/application/controllers/Qrz.php index 7ef853fd1..94d5500a5 100644 --- a/application/controllers/Qrz.php +++ b/application/controllers/Qrz.php @@ -410,8 +410,8 @@ class Qrz extends CI_Controller { $status = $this->logbook_model->import_check($time_on, $record['call'], $record['band'], $record['mode'], $record['station_callsign']); if($status[0] == "Found") { - $qrz_status = $this->logbook_model->qrz_update($time_on, $record['call'], $record['band'], $qsl_date, $record['qsl_rcvd'],$record['station_callsign']); - + $qrz_status = $this->logbook_model->qrz_update($status[1], $qsl_date, $record['qsl_rcvd']); + // log_message('error', $record['call'].": ".$qrz_status); $table .= ""; $table .= "".$record['station_callsign'].""; $table .= "".$time_on.""; diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index f148b2c3d..0967fe9f0 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -3251,17 +3251,14 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray = } } - function qrz_update($datetime, $callsign, $band, $qsl_date, $qsl_status, $station_callsign) { + function qrz_update($primarykey, $qsl_date, $qsl_status) { $data = array( 'COL_QRZCOM_QSO_DOWNLOAD_DATE' => $qsl_date, 'COL_QRZCOM_QSO_DOWNLOAD_STATUS' => $qsl_status, ); - $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('COL_STATION_CALLSIGN', $station_callsign); + $this->db->where('COL_PRIMARY_KEY', $primarykey); if ($this->db->update($this->config->item('table_name'), $data)) { unset($data);