diff --git a/application/controllers/Logbook.php b/application/controllers/Logbook.php index ca03bc86a..13882f368 100644 --- a/application/controllers/Logbook.php +++ b/application/controllers/Logbook.php @@ -127,12 +127,12 @@ class Logbook extends CI_Controller { $return['dxcc'] = $this->dxcheck($callsign,$date); - $lookupcall=$this->logbook_model->get_plaincall($callsign); - - $return['partial'] = $this->partial($lookupcall, $band); + $lookupcall = $this->logbook_model->get_plaincall($callsign); $callbook = $this->logbook_model->loadCallBook($callsign, $this->config->item('use_fullname')); + $return['partial'] = $this->partial($lookupcall, $callbook, $callsign, $band); + if ($this->session->userdata('user_measurement_base') == NULL) { $measurement_base = $this->config->item('measurement_base'); } else { @@ -614,7 +614,7 @@ class Logbook extends CI_Controller { $this->load->view('interface_assets/footer'); } - function partial($id, $band = null) { + function partial($lookupcall, $callbook, $callsign, $band = null) { $this->load->model('user_model'); if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; } @@ -631,10 +631,10 @@ class Logbook extends CI_Controller { $this->db->where_in('station_profile.station_id', $logbooks_locations_array); $this->db->group_start(); - $this->db->where($this->config->item('table_name').'.COL_CALL', $id); - $this->db->or_like($this->config->item('table_name').'.COL_CALL', '/'.$id,'before'); - $this->db->or_like($this->config->item('table_name').'.COL_CALL', $id.'/','after'); - $this->db->or_like($this->config->item('table_name').'.COL_CALL', '/'.$id.'/'); + $this->db->where($this->config->item('table_name').'.COL_CALL', $lookupcall); + $this->db->or_like($this->config->item('table_name').'.COL_CALL', '/'.$lookupcall,'before'); + $this->db->or_like($this->config->item('table_name').'.COL_CALL', $lookupcall.'/','after'); + $this->db->or_like($this->config->item('table_name').'.COL_CALL', '/'.$lookupcall.'/'); $this->db->group_end(); $this->db->order_by($this->config->item('table_name').".COL_TIME_ON", "desc"); @@ -825,33 +825,29 @@ class Logbook extends CI_Controller { $html .= ""; return $html; } else { + $callsigninfo['callsign'] = $callbook; - if (!$this->load->is_loaded('callbook')) { - $this->load->library('callbook'); - } - - $callsign['callsign'] = $this->callbook->getCallbookData($id); - - if (isset($callsign['callsign']['dxcc'])) { + if (isset($callsigninfo['callsign']['dxcc'])) { $this->load->model('logbook_model'); - $entity = $this->logbook_model->get_entity($callsign['callsign']['dxcc']); - $callsign['callsign']['dxcc_name'] = $entity['name']; - $callsign['dxcc_worked'] = $this->logbook_model->check_if_dxcc_worked_in_logbook($callsign['callsign']['dxcc'], null, $this->session->userdata('user_default_band')); - $callsign['dxcc_confirmed'] = $this->logbook_model->check_if_dxcc_cnfmd_in_logbook($callsign['callsign']['dxcc'], null, $this->session->userdata('user_default_band')); + $entity = $this->logbook_model->get_entity($callsigninfo['callsign']['dxcc']); + $callsigninfo['callsign']['dxcc_name'] = $entity['name']; + $callsigninfo['dxcc_worked'] = $this->logbook_model->check_if_dxcc_worked_in_logbook($callsigninfo['callsign']['dxcc'], null, $this->session->userdata('user_default_band')); + $callsigninfo['dxcc_confirmed'] = $this->logbook_model->check_if_dxcc_cnfmd_in_logbook($callsigninfo['callsign']['dxcc'], null, $this->session->userdata('user_default_band')); } - if (isset($callsign['callsign']['gridsquare'])) { + if (isset($callsigninfo['callsign']['gridsquare'])) { $this->load->model('logbook_model'); - $callsign['grid_worked'] = $this->logbook_model->check_if_grid_worked_in_logbook(strtoupper(substr($callsign['callsign']['gridsquare'],0,4)), null, $band)->num_rows(); + $callsigninfo['grid_worked'] = $this->logbook_model->check_if_grid_worked_in_logbook(strtoupper(substr($callsigninfo['callsign']['gridsquare'],0,4)), null, $band)->num_rows(); } - if (isset($callsign['callsign']['error'])) { - $callsign['error'] = $callsign['callsign']['error']; + if (isset($callsigninfo['callsign']['error'])) { + $callsigninfo['error'] = $callsigninfo['callsign']['error']; } - $callsign['id'] = strtoupper($id); - $callsign['lotw_lastupload'] = $this->logbook_model->check_last_lotw($id); - return $this->load->view('search/result', $callsign, true); + $callsigninfo['lookupcall'] = strtoupper($lookupcall); + $callsigninfo['realcall'] = strtoupper($callsign); + $callsigninfo['lotw_lastupload'] = $this->logbook_model->check_last_lotw($callsign); + return $this->load->view('search/result', $callsigninfo, true); } } diff --git a/application/libraries/Callbook.php b/application/libraries/Callbook.php index a7f24c7a2..06cd40f91 100644 --- a/application/libraries/Callbook.php +++ b/application/libraries/Callbook.php @@ -18,33 +18,27 @@ class Callbook { // Implement the following: // - Implement callsign reduced logic public function getCallbookData($callsign) { - $reduced = false; - - if (strpos($callsign, "/") !== false) { - $reduced = true; - } - switch ($this->ci->config->item('callbook')) { case 'qrz': if ($this->ci->config->item('qrz_username') == null || $this->ci->config->item('qrz_password') == null) { $callbook['error'] = 'Lookup not configured. Please review configuration.'; return $callbook; } - return $this->qrz($this->ci->config->item('qrz_username'), $this->ci->config->item('qrz_password'), $callsign, $this->ci->config->item('use_fullname'), $reduced); + return $this->qrz($this->ci->config->item('qrz_username'), $this->ci->config->item('qrz_password'), $callsign, $this->ci->config->item('use_fullname')); break; case 'qrzcq': if ($this->ci->config->item('qrzcq_username') == null || $this->ci->config->item('qrzcq_password') == null) { $callbook['error'] = 'Lookup not configured. Please review configuration.'; return $callbook; } - return $this->qrzcq($this->ci->config->item('qrzcq_username'), $this->ci->config->item('qrzcq_password'), $callsign, $reduced); + return $this->qrzcq($this->ci->config->item('qrzcq_username'), $this->ci->config->item('qrzcq_password'), $callsign); break; case 'hamqth': if ($this->ci->config->item('hamqth_username') == null || $this->ci->config->item('hamqth_password') == null) { $callbook['error'] = 'Lookup not configured. Please review configuration.'; return $callbook; } - return $this->hamqth($this->ci->config->item('hamqth_username'), $this->ci->config->item('hamqth_password'), $callsign, $reduced); + return $this->hamqth($this->ci->config->item('hamqth_username'), $this->ci->config->item('hamqth_password'), $callsign); break; default: $callbook['error'] = 'No callbook defined. Please review configuration.'; @@ -52,7 +46,7 @@ class Callbook { } } - function qrz($username, $password, $callsign, $fullname, $reduced) { + function qrz($username, $password, $callsign, $fullname) { if (!$this->ci->load->is_loaded('qrz')) { $this->ci->load->library('qrz'); } @@ -62,12 +56,12 @@ class Callbook { $this->ci->session->set_userdata('qrz_session_key', $qrz_session_key); } - $callbook = $this->ci->qrz->search($callsign, $this->ci->session->userdata('qrz_session_key'), $fullname, $reduced); + $callbook = $this->ci->qrz->search($callsign, $this->ci->session->userdata('qrz_session_key'), $fullname); if ($callbook['error'] ?? '' == 'Invalid session key') { $qrz_session_key = $this->ci->qrz->session($username, $password); $this->ci->session->set_userdata('qrz_session_key', $qrz_session_key); - $callbook = $this->ci->qrz->search($callsign, $this->ci->session->userdata('qrz_session_key'), $fullname, $reduced); + $callbook = $this->ci->qrz->search($callsign, $this->ci->session->userdata('qrz_session_key'), $fullname); } if (strpos($callbook['error'] ?? '', 'Not found') !== false && strpos($callsign, "/") !== false) { @@ -79,7 +73,7 @@ class Callbook { return $callbook; } - function qrzcq($username, $password, $callsign, $reduced) { + function qrzcq($username, $password, $callsign) { if (!$this->ci->load->is_loaded('qrzcq')) { $this->ci->load->library('qrzcq'); } @@ -94,12 +88,12 @@ class Callbook { } } - $callbook = $this->ci->qrzcq->search($callsign, $this->ci->session->userdata('qrzcq_session_key'), $reduced); + $callbook = $this->ci->qrzcq->search($callsign, $this->ci->session->userdata('qrzcq_session_key')); if ($callbook['error'] ?? '' == 'Invalid session key') { $qrzcq_session_key = $this->ci->qrzcq->session($username, $password); $this->ci->session->set_userdata('qrzcq_session_key', $qrzcq_session_key); - $callbook = $this->ci->qrzcq->search($callsign, $this->ci->session->userdata('qrzcq_session_key'), $reduced); + $callbook = $this->ci->qrzcq->search($callsign, $this->ci->session->userdata('qrzcq_session_key')); } if (strpos($callbook['error'] ?? '', 'Not found') !== false && strpos($callsign, "/") !== false) { @@ -111,7 +105,7 @@ class Callbook { return $callbook; } - function hamqth($username, $password, $callsign, $reduced) { + function hamqth($username, $password, $callsign) { // Load the HamQTH library if (!$this->ci->load->is_loaded('hamqth')) { $this->ci->load->library('hamqth'); @@ -122,13 +116,13 @@ class Callbook { $this->ci->session->set_userdata('hamqth_session_key', $hamqth_session_key); } - $callbook = $this->ci->hamqth->search($callsign, $this->ci->session->userdata('hamqth_session_key'), $reduced); + $callbook = $this->ci->hamqth->search($callsign, $this->ci->session->userdata('hamqth_session_key')); // If HamQTH session has expired, start a new session and retry the search. if ($callbook['error'] == "Session does not exist or expired") { $hamqth_session_key = $this->ci->hamqth->session($username, $password); $this->ci->session->set_userdata('hamqth_session_key', $hamqth_session_key); - $callbook = $this->ci->hamqth->search($callsign, $this->ci->session->userdata('hamqth_session_key'), $reduced); + $callbook = $this->ci->hamqth->search($callsign, $this->ci->session->userdata('hamqth_session_key')); } if (strpos($callbook['error'] ?? '', 'Not found') !== false && strpos($callsign, "/") !== false) { diff --git a/application/views/search/result.php b/application/views/search/result.php index 8fbe57a28..602f0684a 100644 --- a/application/views/search/result.php +++ b/application/views/search/result.php @@ -1,9 +1,9 @@
= sprintf(__("Sorry, but we didn't find any past QSOs with %s"), str_replace('0', 'Ø', $id)); ?>
+= sprintf(__("Sorry, but we didn't find any past QSOs with %s"), str_replace('0', 'Ø', $lookupcall)); ?>
-| = __("DXCC"); ?> | - |