Merge pull request #2779 from abarrau/ans-qso-search-qrz

[QSO] fix lookup return result with the real callsign
pull/2787/head^2
Andreas Kristiansen 2023-12-06 17:45:48 +01:00 zatwierdzone przez GitHub
commit 5ab5f93b8f
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 16 dodań i 8 usunięć

Wyświetl plik

@ -136,14 +136,18 @@ class Logbook extends CI_Controller {
$return['dxcc'] = $this->dxcheck($callsign);
$split_callsign=explode('/',$callsign);
if (isset($split_callsign[1]) && ($split_callsign[1] != "")) { // Do we have "/" in Call?
if (strlen($split_callsign[1])>3) { // Last Element longer than 3 chars? Take that as call
if (count($split_callsign)==1) { // case F0ABC --> return cel 0 //
$lookupcall = $split_callsign[0];
} else if (count($split_callsign)==3) { // case EA/F0ABC/P --> return cel 1 //
$lookupcall = $split_callsign[1];
} else { // case F0ABC/P --> return cel 0 OR case EA/FOABC --> retunr 1 (normaly not exist) //
if (in_array(strtoupper($split_callsign[1]), array('P','M','MM','QRP','0','1','2','3','4','5','6','7','8','9'))) {
$lookupcall = $split_callsign[0];
} else if (strlen($split_callsign[1])>3) { // Last Element longer than 3 chars? Take that as call
$lookupcall = $split_callsign[1];
} else { // Last Element up to 3 Chars? Take first element as Call
} else { // Last Element up to 3 Chars? Take first element as Call
$lookupcall = $split_callsign[0];
}
} else {
$lookupcall=$callsign;
}
$return['partial'] = $this->partial($lookupcall);
@ -257,7 +261,7 @@ class Logbook extends CI_Controller {
return false;
}
function worked_grid_before($gridsquare, $type, $band, $mode)
function worked_grid_before($gridsquare, $type, $band, $mode)
{
if (strlen($gridsquare) < 4)
return false;
@ -707,7 +711,11 @@ function worked_grid_before($gridsquare, $type, $band, $mode)
$this->db->where_in('station_profile.station_id', $logbooks_locations_array);
$this->db->order_by(''.$this->config->item('table_name').'.COL_TIME_ON', "desc");
$this->db->like($this->config->item('table_name').'.COL_CALL', $id);
$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->order_by($this->config->item('table_name').".COL_TIME_ON", "desc");
$this->db->limit(5);
@ -985,7 +993,7 @@ function worked_grid_before($gridsquare, $type, $band, $mode)
if($data['callsign']['error'] == "Session does not exist or expired") {
$hamqth_session_key = $this->hamqth->session($this->config->item('hamqth_username'), $this->config->item('hamqth_password'));
$this->session->set_userdata('hamqth_session_key', $hamqth_session_key);
$data['callsign'] = $this->hamqth->search($callsign, $this->session->userdata('hamqth_session_key'));
$data['callsign'] = $this->hamqth->search($id, $this->session->userdata('hamqth_session_key'));
}
if (isset($data['callsign']['gridsquare'])) {
$CI = &get_instance();