From adf658903bfdeeeffbb8fc2ea6d025cb83ed7127 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Mon, 18 Aug 2025 14:32:04 +0100 Subject: [PATCH] Improve DXCC ID assignment logic in Logbook_model Refines how DXCC ID is set based on country and input values, ensuring correct assignment when country is provided and dxcc_id is zero. This helps prevent incorrect DXCC ID values during logbook entry creation. --- application/models/Logbook_model.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 89a72b64..a507af01 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -99,10 +99,13 @@ class Logbook_model extends CI_Model if ($this->input->post('country') == "") { $dxcc = $this->check_dxcc_table(strtoupper(trim($callsign)), $datetime); $country = ucwords(strtolower($dxcc[1]), "- (/"); + $dxcc_id = $dxcc[0]; } else { $country = $this->input->post('country'); } + + if ($this->input->post('cqz') == "") { $dxcc = $this->check_dxcc_table(strtoupper(trim($callsign)), $datetime); if (empty($dxcc[2])) { @@ -123,7 +126,13 @@ class Logbook_model extends CI_Model $dxcc_id = $dxcc[0]; } } else { - $dxcc_id = $this->input->post('dxcc_id'); + // if $country isn't empty + if (!empty($country) && $this->input->post('dxcc_id') == "0") { + $dxcc_id = $dxcc_id; + } else { + $dxcc_id = $this->input->post('dxcc_id'); + } + } if ($this->input->post('continent') == "") {