From c9490b9fc8ed5b21613786ca02260c84e004c30c Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Sun, 17 Aug 2025 11:32:18 +0100 Subject: [PATCH] Handle entity type when formatting country name Updated country name formatting to support both array and object types for the entity returned by get_entity. This ensures compatibility with different data structures and prevents errors when accessing the country name. --- 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 c4d5bdb4..52c2598e 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -1087,7 +1087,16 @@ class Logbook_model extends CI_Model $entity = $this->get_entity($this->input->post('dxcc_id')); $stationId = $this->input->post('station_profile'); - $country = ucwords(strtolower($entity['name']), "- (/"); + + if (is_array($entity)) { + $rawCountry = $entity['name'] ?? ''; + } elseif (is_object($entity)) { + $rawCountry = $entity->name ?? ''; + } else { + $rawCountry = (string)$entity; + } + $country = ucwords(strtolower($rawCountry), "- (/" + ); // be sure that station belongs to user $CI = &get_instance();