Fill US county from callbook / logbook

pull/1460/head
phl0 2022-04-16 22:07:13 +02:00
rodzic a2c831f26c
commit ced69b8ea4
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 48EA1E640798CA9A
3 zmienionych plików z 35 dodań i 0 usunięć

Wyświetl plik

@ -149,6 +149,7 @@ class Logbook extends CI_Controller {
$return['callsign_iota'] = $this->logbook_model->call_iota($callsign);
$return['qsl_manager'] = $this->logbook_model->call_qslvia($callsign);
$return['callsign_state'] = $this->logbook_model->call_state($callsign);
$return['callsign_us_county'] = $this->logbook_model->call_us_county($callsign);
$return['bearing'] = $this->bearing($return['callsign_qra'], $measurement_base, $station_id);
$return['workedBefore'] = $this->worked_grid_before($return['callsign_qra'], $type, $band, $mode);
if ($this->session->userdata('user_show_qrz_image')) {

Wyświetl plik

@ -841,6 +841,28 @@ class Logbook_model extends CI_Model {
return $qsl_state;
}
function call_us_county($callsign) {
$this->db->select('COL_CALL, COL_CNTY');
$this->db->where('COL_CALL', $callsign);
$where = "COL_NAME != \"\"";
$this->db->where($where);
$this->db->order_by("COL_TIME_ON", "desc");
$this->db->limit(1);
$query = $this->db->get($this->config->item('table_name'));
$name = "";
if ($query->num_rows() > 0)
{
$data = $query->row();
$qsl_county = $data->COL_CNTY;
}
// Strip state identifier
$qsl_county = substr($qsl_county, (strpos($qsl_county, ',')+1));
return $qsl_county;
}
function call_qth($callsign) {
$this->db->select('COL_CALL, COL_QTH, COL_TIME_ON');
$this->db->where('COL_CALL', $callsign);

Wyświetl plik

@ -289,6 +289,9 @@ function reset_fields() {
var $select = $('#darc_dok').selectize();
var selectize = $select[0].selectize;
selectize.clear();
$select = $('#stationCntyInput').selectize();
selectize = $select[0].selectize;
selectize.clear();
mymap.setView(pos, 12);
mymap.removeLayer(markers);
@ -472,6 +475,15 @@ $("#callsign").focusout(function() {
$("#input_usa_state").val(result.callsign_state).trigger('change');
}
/*
* Update county with returned value
*/
if( $('#stationCntyInput').has('option').length == 0 && result.callsign_us_county != "") {
var $select = $('#stationCntyInput').selectize();
var selectize = $select[0].selectize;
selectize.addOption({name: result.callsign_us_county});
selectize.setValue(result.callsign_us_county, false);
}
if($('#iota_ref').val() == "") {
$('#iota_ref').val(result.callsign_iota);