From b00f76f3cef17017f4d164ffcf2688998d7e7413 Mon Sep 17 00:00:00 2001 From: int2001 Date: Tue, 30 Jan 2024 09:17:18 +0000 Subject: [PATCH] A little more errorcatching and added cont to the API --- application/controllers/Api.php | 4 ++++ application/models/Logbook_model.php | 29 ++++++++++++++-------------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/application/controllers/Api.php b/application/controllers/Api.php index a0024ba81..9d91c5615 100644 --- a/application/controllers/Api.php +++ b/application/controllers/Api.php @@ -516,6 +516,7 @@ class API extends CI_Controller { "dxcc_long" => "", "dxcc_cqz" => "", "dxcc_flag" => "", + "cont" => "", "name" => "", "gridsquare" => "", "location" => "", @@ -574,12 +575,14 @@ class API extends CI_Controller { $return['dxcc_lat'] = $ans2['lat']; $return['dxcc_long'] = $ans2['long']; $return['dxcc_cqz'] = $ans2['cqz']; + $return['cont'] = $ans2['cont']; } else { $return['dxcc_id'] = $callsign_dxcc_lookup['adif']; $return['dxcc'] = $callsign_dxcc_lookup['entity']; $return['dxcc_lat'] = $callsign_dxcc_lookup['lat']; $return['dxcc_long'] = $callsign_dxcc_lookup['long']; $return['dxcc_cqz'] = $callsign_dxcc_lookup['cqz']; + $return['cont'] = $callsign_dxcc_lookup['cont']; } /* @@ -599,6 +602,7 @@ class API extends CI_Controller { $return['state'] = $call_lookup_results->COL_STATE; $return['us_county'] = $call_lookup_results->COL_CNTY; $return['dxcc_id'] = $call_lookup_results->COL_DXCC; + $return['cont'] = $call_lookup_results->COL_CONT; if ($return['gridsquare'] != "") { $return['latlng'] = $this->qralatlng($return['gridsquare']); diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 63d6e4235..3ce1c4bd7 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -1281,22 +1281,22 @@ class Logbook_model extends CI_Model { * */ function call_lookup_result($callsign) { - $this->db->select('COL_CALL, COL_NAME, COL_QSL_VIA, COL_GRIDSQUARE, COL_QTH, COL_IOTA, COL_TIME_ON, COL_STATE, COL_CNTY, COL_DXCC'); - $this->db->where('COL_CALL', $callsign); - $where = "COL_NAME != \"\""; + $this->db->select('COL_CALL, COL_NAME, COL_QSL_VIA, COL_GRIDSQUARE, COL_QTH, COL_IOTA, COL_TIME_ON, COL_STATE, COL_CNTY, COL_DXCC, COL_CONT'); + $this->db->where('COL_CALL', $callsign); + $where = "COL_NAME != \"\""; - $this->db->where($where); + $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(); - } + $this->db->order_by("COL_TIME_ON", "desc"); + $this->db->limit(1); + $query = $this->db->get($this->config->item('table_name')); + $name = ""; + $data=[]; + if ($query->num_rows() > 0) { + $data = $query->row(); + } - return $data; + return $data; } /* Callsign QRA */ @@ -3939,7 +3939,7 @@ function lotw_last_qsl_date($user_id) { $csadditions = '/^P$|^R$|^A$|^M$/'; - $dxcc_exceptions = $this->db->select('`entity`, `adif`, `cqz`') + $dxcc_exceptions = $this->db->select('`entity`, `adif`, `cqz`,`cont`') ->where('call', $call) ->where('(start <= ', $date) ->or_where('start is null)', NULL, false) @@ -3989,6 +3989,7 @@ function lotw_last_qsl_date($user_id) { $result = $this->wpx($call, 1); # use the wpx prefix instead if ($result == '') { $row['adif'] = 0; + $row['cont'] = ''; $row['entity'] = '- NONE -'; $row['cqz'] = 0; $row['long'] = '0';