From df50101af479aeda21ec5934de30c70f26c195fc Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Sat, 31 Jan 2026 19:46:21 +0100 Subject: [PATCH 1/7] don't load stations model on each iteration of import_bulk() --- application/models/Logbook_model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index c2ce9f40c..3365bac1a 100644 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -4624,7 +4624,7 @@ class Logbook_model extends CI_Model { */ function import($record, $station_id = "0", $skipDuplicate = true, $markClublog = false, $markLotw = false, $dxccAdif = false, $markQrz = false, $markEqsl = false, $markHrd = false, $markDcl = false, $skipexport = false, $operatorName = false, $apicall = false, $skipStationCheck = false, $batchmode = false, $station_id_ok = false, $station_profile = null, $station_qslmsg = null) { // be sure that station belongs to user - $this->load->model('stations'); + $this->load->is_loaded('stations') ?: $this->load->model('stations'); if ($station_id_ok == false) { if (!$this->stations->check_station_is_accessible($station_id) && $apicall == false) { return 'Station not accessible
'; From af8918c3ffd1ead8b3c86605610bb3fe10a894f2 Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Sat, 31 Jan 2026 20:00:22 +0100 Subject: [PATCH 2/7] if dxcc is set in the record we complete the array with data we got anyway --- application/models/Logbook_model.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 3365bac1a..dbcebdd39 100644 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -4785,7 +4785,7 @@ class Logbook_model extends CI_Model { if ($dxccAdif != NULL) { if (isset($record['dxcc'])) { $entity = $this->get_entity($record['dxcc']); - $dxcc = array($record['dxcc'] ?? '', $entity['name'] ?? ''); + $dxcc = array($record['dxcc'] ?? '', $entity['name'] ?? '', $entity['cqz'] ?? '', $entity['cont'] ?? ''); } else { if ($this->dxcc_object == null) { $this->dxcc_object = new Dxcc(null); @@ -5652,7 +5652,7 @@ class Logbook_model extends CI_Model { } public function get_entity($dxcc) { - $sql = "SELECT name, cqz, lat, `long` FROM dxcc_entities WHERE adif = ?"; + $sql = "SELECT `adif`, `name`, `cqz`, `ituz`, `cont`, `lat`, `long` FROM dxcc_entities WHERE adif = ?"; $query = $this->db->query($sql, $dxcc); if ($query->result() > 0) { From e2bcbfc84ac41dd38f296b5c7625e1b40be90a90 Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Sat, 31 Jan 2026 20:04:39 +0100 Subject: [PATCH 3/7] stations model is already loaded at this point --- application/models/Logbook_model.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index dbcebdd39..f700b9332 100644 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -4975,10 +4975,10 @@ class Logbook_model extends CI_Model { $input_ant_path = NULL; } - /* - Validate QSL Fields - qslrdate, qslsdate - */ + /** + * Validate QSL Fields + * qslrdate, qslsdate + */ if (($record['qslrdate'] ?? '') != '') { if (validateADIFDate($record['qslrdate']) == true) { @@ -5155,7 +5155,6 @@ class Logbook_model extends CI_Model { // Get active station_id from station profile if one hasn't been provided if ($station_id == "" || $station_id == "0") { - $this->load->model('stations'); $station_id = $this->stations->find_active(); } From 8ee1537c9628239a5ca8296b89fa25614ef7278b Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Sat, 31 Jan 2026 20:05:30 +0100 Subject: [PATCH 4/7] removed unused variable --- application/models/Logbook_model.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index f700b9332..cf48093fa 100644 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -5168,7 +5168,7 @@ class Logbook_model extends CI_Model { // If user checked to mark QSOs as uploaded to QRZ or HRDLog Logbook, or else we try to find info in ADIF import. if ($markHrd != null) { $input_hrdlog_qso_upload_status = 'Y'; - $input_hrdlog_qso_upload_date = $date = date("Y-m-d H:i:s", strtotime("now")); + $input_hrdlog_qso_upload_date = date("Y-m-d H:i:s", strtotime("now")); } else { $input_hrdlog_qso_upload_date = (!empty($record['hrdlog_qso_upload_date'])) ? $record['hrdlog_qso_upload_date'] : null; $input_hrdlog_qso_upload_status = (!empty($record['hrdlog_qso_upload_status'])) ? $record['hrdlog_qso_upload_status'] : ''; @@ -5176,7 +5176,7 @@ class Logbook_model extends CI_Model { if ($markQrz != null) { $input_qrzcom_qso_upload_status = 'Y'; - $input_qrzcom_qso_upload_date = $date = date("Y-m-d H:i:s", strtotime("now")); + $input_qrzcom_qso_upload_date = date("Y-m-d H:i:s", strtotime("now")); } else { $input_qrzcom_qso_upload_date = (!empty($record['qrzcom_qso_upload_date'])) ? $record['qrzcom_qso_upload_date'] : null; $input_qrzcom_qso_upload_status = (!empty($record['qrzcom_qso_upload_status'])) ? $record['qrzcom_qso_upload_status'] : ''; @@ -5184,7 +5184,7 @@ class Logbook_model extends CI_Model { if ($markDcl != null) { $input_dcl_qso_upload_status = 'Y'; - $input_dcl_qso_upload_date = $date = date("Y-m-d H:i:s", strtotime("now")); + $input_dcl_qso_upload_date = date("Y-m-d H:i:s", strtotime("now")); } else { $input_dcl_qso_upload_date = (!empty($record['dcl_qslsdate'])) ? $record['dcl_qslsdate'] : null; $input_dcl_qso_upload_status = (!empty($record['dcl_qsl_sent'])) ? $record['dcl_qsl_sent'] : ''; From dc29d69e4ee232b7cebbe091677a464202fce004 Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Sat, 31 Jan 2026 20:14:30 +0100 Subject: [PATCH 5/7] stations model is already loaded at this point and Mh lib only needs to be loaded once in a session --- application/models/Logbook_model.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index cf48093fa..1932cafe2 100644 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -5410,10 +5410,9 @@ class Logbook_model extends CI_Model { } if ($apicall && (($this->config->item('mqtt_server') ?? '') != '')) { - $this->load->model('stations'); - $this->load->library('Mh'); - $h_user=$this->stations->get_user_from_station($station_id); - $event_data=$data; + $this->load->is_loaded('Mh') ?: $this->load->library('Mh'); + $h_user = $this->stations->get_user_from_station($station_id); + $event_data = $data; $event_data['user_name']=($h_user->user_name ?? ''); $event_data['user_id']=($h_user->user_id ?? ''); $this->mh->wl_event('qso/logged/api/'.($h_user->user_id ?? ''), json_encode($event_data)); From 675c0a229c9d8f4cf4f80f808986a7b4120ec97d Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Sat, 31 Jan 2026 20:15:01 +0100 Subject: [PATCH 6/7] @int2001 you know ;-) --- application/models/Logbook_model.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 1932cafe2..5abc0fe81 100644 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -5413,8 +5413,8 @@ class Logbook_model extends CI_Model { $this->load->is_loaded('Mh') ?: $this->load->library('Mh'); $h_user = $this->stations->get_user_from_station($station_id); $event_data = $data; - $event_data['user_name']=($h_user->user_name ?? ''); - $event_data['user_id']=($h_user->user_id ?? ''); + $event_data['user_name'] = ($h_user->user_name ?? ''); + $event_data['user_id'] = ($h_user->user_id ?? ''); $this->mh->wl_event('qso/logged/api/'.($h_user->user_id ?? ''), json_encode($event_data)); unset($event_data); unset($h_user); From 2b46230a424743eb10d9884508043d5c944ba9fa Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Mon, 2 Feb 2026 07:54:24 +0100 Subject: [PATCH 7/7] Avoid a null error --- application/models/Logbook_model.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 5abc0fe81..897974f15 100644 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -86,7 +86,7 @@ class Logbook_model extends CI_Model { $prop_mode = $qso_data['prop_mode'] ?? NULL; $email = $qso_data['email'] ?? NULL; $region = $qso_data['region'] ?? NULL; - + // In case of a satellite name we force the $prop_mode to SAT $prop_mode = ($qso_data['sat_name'] ?? NULL) != NULL ? "SAT" : $prop_mode; @@ -118,7 +118,7 @@ class Logbook_model extends CI_Model { $contestid = $qso_data['contestname'] ?? NULL; $tx_power = filter_var(($qso_data['transmit_power'] ?? NULL), FILTER_VALIDATE_FLOAT) ?? NULL; - + if (($qso_data['radio'] ?? '') == 'ws') { // WebSocket $radio_name = $qso_data['radio_ws_name']; @@ -131,9 +131,9 @@ class Logbook_model extends CI_Model { // Cache DXCC lookup to avoid calling check_dxcc_table() 4 times if atleast one of these fields is empty $dxcc = NULL; - $needs_dxcc_lookup = empty($qso_data['country']) || - empty($qso_data['cqz']) || - empty($qso_data['dxcc_id']) || + $needs_dxcc_lookup = empty($qso_data['country']) || + empty($qso_data['cqz']) || + empty($qso_data['dxcc_id']) || empty($qso_data['continent']); if ($needs_dxcc_lookup) { @@ -235,7 +235,7 @@ class Logbook_model extends CI_Model { } else { $band = $qso_data['band']; } - + // Create array with QSO Data $data = array( 'COL_TIME_ON' => $datetime, @@ -5403,7 +5403,7 @@ class Logbook_model extends CI_Model { $data['COL_STATION_CALLSIGN'] = strtoupper(trim($row['station_callsign'])); $data['COL_MY_DXCC'] = strtoupper(trim($row['station_dxcc'])); $data['COL_MY_COUNTRY'] = strtoupper(trim($row['station_country'])); - $data['COL_MY_CNTY'] = strtoupper(trim($row['station_cnty'])); + $data['COL_MY_CNTY'] = strtoupper(trim($row['station_cnty'] ?? '')); $data['COL_MY_CQ_ZONE'] = strtoupper(trim($row['station_cq'])); $data['COL_MY_ITU_ZONE'] = strtoupper(trim($row['station_itu'])); }