Fetch email from callbook / last QSOs

This commit is contained in:
phl0
2024-11-21 15:58:51 +01:00
parent 1f527771d3
commit 99fef495ce
5 changed files with 29 additions and 0 deletions

View File

@@ -144,6 +144,7 @@ class Logbook extends CI_Controller {
$return['callsign_distance'] = $this->distance($return['callsign_qra'], $station_id);
$return['callsign_qth'] = $this->nval($callbook['city'] ?? '', $this->logbook_model->call_qth($callsign));
$return['callsign_iota'] = $this->nval($callbook['iota'] ?? '', $this->logbook_model->call_iota($callsign));
$return['callsign_email'] = $this->nval($callbook['email'] ?? '', $this->logbook_model->call_email($callsign));
$return['qsl_manager'] = $this->nval($callbook['qslmgr'] ?? '', $this->logbook_model->call_qslvia($callsign));
$return['callsign_state'] = $this->nval($callbook['state'] ?? '', $this->logbook_model->call_state($callsign));
$return['callsign_us_county'] = $this->nval($callbook['us_county'] ?? '', $this->logbook_model->call_us_county($callsign));

View File

@@ -81,6 +81,7 @@ class Hamqth {
// we always want to return name and callsign
$data['callsign'] = (string)$xml->search->callsign;
$data['name'] = (string)$xml->search->nick;
$data['email'] = (string)$xml->search->email;
// only return certain data of a callsign which does not contain a pre- or suffix (see https://github.com/wavelog/wavelog/issues/452)
if ($reduced == false) {

View File

@@ -96,6 +96,8 @@ class Qrz {
$data['name'] = (string)$xml->Callsign->fname;
}
$data['email'] = (string)$xml->Callsign->email;
// we always give back the name, no matter if reduced data or not
$data['name'] = trim($data['name']);

View File

@@ -1624,6 +1624,26 @@ class Logbook_model extends CI_Model {
return $name;
}
function call_email($callsign) {
if ($callsign !== $this->get_plaincall($callsign)) {
return null;
}
$this->db->select('COL_CALL, COL_EMAIL, COL_TIME_ON');
$this->db->join('station_profile', 'station_profile.station_id = ' . $this->config->item('table_name') . '.station_id');
$this->db->where('COL_CALL', $callsign);
$this->db->where('station_profile.user_id', $this->session->userdata('user_id'));
$this->db->order_by("COL_TIME_ON", "desc");
$this->db->limit(1);
$query = $this->db->get($this->config->item('table_name'));
$email = "";
if ($query->num_rows() > 0) {
$data = $query->row();
$email = $data->COL_EMAIL;
}
return $email;
}
function times_worked($callsign) {
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->db->select('count(1) as TWKED');

View File

@@ -764,6 +764,11 @@ $("#callsign").on("focusout", function () {
$('#name').val(result.callsign_name);
}
/* Find Operators E-mail */
if ($('#email').val() == "") {
$('#email').val(result.callsign_email);
}
if ($('#continent').val() == "") {
$('#continent').val(result.dxcc.cont);
}