From 8e5903a5bc4787145785a63415312f4a190073a6 Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 19 Feb 2026 09:25:17 +0100 Subject: [PATCH] Query callbook (hamqth) for DARC DOK --- application/controllers/Logbook.php | 1 + application/controllers/Lookup.php | 18 ------------------ application/libraries/Hamqth.php | 2 ++ application/models/Logbook_model.php | 10 ++++++++-- assets/js/sections/qso.js | 15 ++++++++------- 5 files changed, 19 insertions(+), 27 deletions(-) diff --git a/application/controllers/Logbook.php b/application/controllers/Logbook.php index 6722fc8b5..44434ed35 100644 --- a/application/controllers/Logbook.php +++ b/application/controllers/Logbook.php @@ -178,6 +178,7 @@ class Logbook extends CI_Controller { $return['callsign_us_county'] = $this->nval($this->logbook_model->call_us_county($callsign), $callbook['us_county'] ?? '', $lookup_priority); $return['callsign_ituz'] = $this->nval($this->logbook_model->call_ituzone($callsign), $callbook['ituz'] ?? '', $lookup_priority); $return['callsign_cqz'] = $this->nval($this->logbook_model->call_cqzone($callsign), $callbook['cqz'] ?? '', $lookup_priority); + $return['callsign_darc_dok'] = $this->nval($this->logbook_model->call_darc_dok($callsign), $callbook['darc_dok'] ?? '', $lookup_priority); $return['workedBefore'] = $this->worked_grid_before($return['callsign_qra'], $band, $mode); $return['confirmed'] = $this->confirmed_grid_before($return['callsign_qra'], $band, $mode); $return['timesWorked'] = $this->logbook_model->times_worked($lookupcall); diff --git a/application/controllers/Lookup.php b/application/controllers/Lookup.php index 68e21242c..ad5ea33fd 100644 --- a/application/controllers/Lookup.php +++ b/application/controllers/Lookup.php @@ -158,24 +158,6 @@ class Lookup extends CI_Controller { } } - public function dok($call) { - session_write_close(); - - if($call) { - $call = str_replace("-","/",$call); - $uppercase_callsign = strtoupper($call); - } - - // DOK results from logbook - $this->load->model('logbook_model'); - - $query = $this->logbook_model->get_dok($uppercase_callsign); - - if ($query->row()) { - echo $query->row()->COL_DARC_DOK; - } - } - public function ham_of_note($call = '') { session_write_close(); diff --git a/application/libraries/Hamqth.php b/application/libraries/Hamqth.php index de0c34e03..5c3bbc403 100644 --- a/application/libraries/Hamqth.php +++ b/application/libraries/Hamqth.php @@ -100,6 +100,7 @@ class Hamqth { $data['error'] = (string)$xml->session->error; $data['ituz'] = (string)$xml->search->itu; $data['cqz'] = (string)$xml->search->cq; + $data['darc_dok'] = (string)$xml->search->dok; if ($xml->search->country == "United States") { $data['us_county'] = (string)$xml->search->us_county; @@ -120,6 +121,7 @@ class Hamqth { $data['error'] = (string)$xml->session->error; $data['ituz'] = ''; $data['cqz'] = ''; + $data['darc_dok'] = ''; $data['us_county'] = ''; diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index b56a86925..ef6455894 100644 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -777,7 +777,7 @@ class Logbook_model extends CI_Model { return $this->db->get($this->config->item('table_name')); } - public function get_dok($callsign) { + public function call_darc_dok($callsign) { $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); $this->db->select('COL_DARC_DOK'); @@ -786,7 +786,13 @@ class Logbook_model extends CI_Model { $this->db->order_by("COL_TIME_ON", "desc"); $this->db->limit(1); - return $this->db->get($this->config->item('table_name')); + $query = $this->db->get($this->config->item('table_name')); + if ($query->num_rows() > 0) { + $data = $query->row(); + return $data->COL_DARC_DOK; + } else { + return NULL; + } } function add_qso($data, $skipexport = false, $batchmode = false) { diff --git a/assets/js/sections/qso.js b/assets/js/sections/qso.js index e4ddc4b2b..6b367f9fa 100644 --- a/assets/js/sections/qso.js +++ b/assets/js/sections/qso.js @@ -1485,7 +1485,8 @@ $("#callsign").on("focusout", function () { lotw_days: result.lotw_days, eqsl_member: result.eqsl_member, qsl_manager: result.qsl_manager, - slot_confirmed: result.dxcc_confirmed_on_band_mode + slot_confirmed: result.dxcc_confirmed_on_band_mode, + darc_dok: result.darc_dok }; window.broadcastLookupResult(broadcastData); } @@ -1589,12 +1590,12 @@ $("#callsign").on("focusout", function () { var $dok_select = $('#darc_dok').selectize(); var dok_selectize = $dok_select[0].selectize; if ((result.dxcc.adif == '230') && (($("#callsign").val().trim().length) > 0)) { - $.get(base_url + 'index.php/lookup/dok/' + $('#callsign').val().toUpperCase().replaceAll('Ø', '0').replaceAll('/','-'), function (result) { - if (result) { - dok_selectize.addOption({ name: result }); - dok_selectize.setValue(result, false); - } - }); + if (result.callsign_darc_dok != '') { + dok_selectize.addOption({ name: result.callsign_darc_dok }); + dok_selectize.setValue(result.callsign_darc_dok, false); + } else { + dok_selectize.clear(); + } } else { dok_selectize.clear(); }