diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index b0f82066c..935d6e1f5 100644 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -8,6 +8,7 @@ class Logbook_model extends CI_Model { private $station_result = []; private $spot_status_cache = []; // In-memory cache for DX cluster spot statuses + private $dxcc_object; public function __construct() { $this->oop_populate_modes(); @@ -194,7 +195,7 @@ class Logbook_model extends CI_Model { $this->input->post('continent') == ""); if ($needs_dxcc_lookup) { - $dxccobj = new Dxcc($date); + $dxccobj = new Dxcc(null); $dxcc = $dxccobj->dxcc_lookup(strtoupper(trim($callsign)), $datetime); } @@ -4913,13 +4914,17 @@ class Logbook_model extends CI_Model { $entity = $this->get_entity($record['dxcc']); $dxcc = array($record['dxcc'] ?? '', $entity['name'] ?? ''); } else { - $dxccobj = new Dxcc(null); - $dxcclookupresult = $dxccobj->dxcc_lookup($record['call'], $time_off); + if ($this->dxcc_object == null) { + $this->dxcc_object = new Dxcc(null); + } + $dxcclookupresult = $this->dxcc_object->dxcc_lookup($record['call'], $time_off); $dxcc = array($dxcclookupresult['adif'], $dxcclookupresult['entity'], $dxcclookupresult['cqz'], $dxcclookupresult['cont']); } } else { - $dxccobj = new Dxcc(null); - $dxcclookupresult = $dxccobj->dxcc_lookup($record['call'], $time_off); + if ($this->dxcc_object == null) { + $this->dxcc_object = new Dxcc(null); + } + $dxcclookupresult = $this->dxcc_object->dxcc_lookup($record['call'], $time_off); $dxcc = array($dxcclookupresult['adif'], $dxcclookupresult['entity'], $dxcclookupresult['cqz'], $dxcclookupresult['cont']); } } else { diff --git a/src/Dxcc/Dxcc.php b/src/Dxcc/Dxcc.php index a0a034621..139c866db 100644 --- a/src/Dxcc/Dxcc.php +++ b/src/Dxcc/Dxcc.php @@ -92,6 +92,7 @@ class Dxcc { $row['cqz'] = 0; $row['long'] = '0'; $row['lat'] = '0'; + $row['cont'] = null; return $row; } else { $call = $result . "AA"; @@ -127,7 +128,14 @@ class Dxcc { } } - return array("Not Found", "Not Found"); + return array( + 'adif' => 0, + 'entity' => '- NONE ', + 'cqz' => '0', + 'long' => '0', + 'lat' => '0', + 'cont' => null + ); } function wpx($testcall, $i) {