From 0025c9a4acf402401f30b5da40d4ff1fd9f60f2e Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Mon, 17 Jun 2019 11:15:05 +0100 Subject: [PATCH] If QSL VIA information is already stored for the callsign in the database populate the QSO form instead of QRZ lookup --- application/controllers/Logbook.php | 2 ++ application/models/Logbook_model.php | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/application/controllers/Logbook.php b/application/controllers/Logbook.php index fe46f901..86d62928 100755 --- a/application/controllers/Logbook.php +++ b/application/controllers/Logbook.php @@ -71,6 +71,7 @@ class Logbook extends CI_Controller { "callsign_qra" => "", "callsign_qth" => "", "callsign_iota" => "", + "qsl_manager" => "", "bearing" => "", "workedBefore" => false, "lotw_member" => $lotw_member, @@ -86,6 +87,7 @@ class Logbook extends CI_Controller { $return['callsign_qra'] = $this->logbook_model->call_qra($callsign); $return['callsign_qth'] = $this->logbook_model->call_qth($callsign); $return['callsign_iota'] = $this->logbook_model->call_iota($callsign); + $return['qsl_manager'] = $this->logbook_model->call_qslvia($callsign); $return['bearing'] = $this->bearing($return['callsign_qra']); $return['workedBefore'] = $this->worked_grid_before($return['callsign_qra']); diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index a3e48686..1926d5b9 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -352,6 +352,26 @@ class Logbook_model extends CI_Model { return $name; } + function call_qslvia($callsign) { + $this->db->select('COL_CALL, COL_QSL_VIA, COL_TIME_ON'); + $this->db->where('COL_CALL', $callsign); + $where = "COL_NAME != \"\""; + + $this->db->where($where); + + $this->db->order_by("COL_TIME_ON", "desc"); + $this->db->limit(1); + $query = $this->db->get($this->config->item('table_name')); + $name = ""; + if ($query->num_rows() > 0) + { + $data = $query->row(); + $qsl_via = $data->COL_QSL_VIA; + } + + return $qsl_via; + } + function call_qth($callsign) { $this->db->select('COL_CALL, COL_QTH, COL_TIME_ON'); $this->db->where('COL_CALL', $callsign);