diff --git a/application/controllers/Logbook.php b/application/controllers/Logbook.php index b602bec5b..7ca91616e 100644 --- a/application/controllers/Logbook.php +++ b/application/controllers/Logbook.php @@ -74,7 +74,7 @@ class Logbook extends CI_Controller { echo json_encode($return, JSON_PRETTY_PRINT); } - function json($tempcallsign, $tempband, $tempmode, $tempstation_id = null, $date = "") { + function json($tempcallsign, $tempband, $tempmode, $tempstation_id = null, $date = "", $count = 5) { session_write_close(); if (($date ?? '') != '') { $date=date("Y-m-d",strtotime($date)); @@ -132,7 +132,7 @@ class Logbook extends CI_Controller { $callbook = $this->logbook_model->loadCallBook($callsign, $this->config->item('use_fullname')); - $return['partial'] = $this->partial($lookupcall, $callbook, $callsign, $return['dxcc'], $lotw_days, $band); + $return['partial'] = $this->partial($lookupcall, $callbook, $callsign, $return['dxcc'], $lotw_days, $band, $count); if ($this->session->userdata('user_measurement_base') == NULL) { $measurement_base = $this->config->item('measurement_base'); @@ -615,7 +615,7 @@ class Logbook extends CI_Controller { $this->load->view('interface_assets/footer'); } - function partial($lookupcall, $callbook, $callsign, $dxcc, $lotw_days, $band = null) { + function partial($lookupcall, $callbook, $callsign, $dxcc, $lotw_days, $band = null, $count = 5) { $this->load->model('user_model'); if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; } @@ -640,7 +640,7 @@ class Logbook extends CI_Controller { $this->db->group_end(); $this->db->order_by($this->config->item('table_name').".COL_TIME_ON", "desc"); - $this->db->limit(5); + $this->db->limit($count); $query = $this->db->get(); } diff --git a/application/controllers/Qso.php b/application/controllers/Qso.php index dc34ef929..70e3b2923 100644 --- a/application/controllers/Qso.php +++ b/application/controllers/Qso.php @@ -9,6 +9,7 @@ class QSO extends CI_Controller { parent::__construct(); $this->load->model('user_model'); if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } + $this->session->set_userdata('last_qsos_count', self::LAST_QSOS_COUNT); } public function index() { @@ -36,7 +37,7 @@ class QSO extends CI_Controller { $data['stations'] = $this->stations->all_of_user(); $data['radios'] = $this->cat->radios(true); $data['radio_last_updated'] = $this->cat->last_updated()->row(); - $data['query'] = $this->logbook_model->last_custom(self::LAST_QSOS_COUNT); + $data['query'] = $this->logbook_model->last_custom($this->session->userdata('last_qsos_count')); $data['dxcc'] = $this->logbook_model->fetchDxcc(); $data['iota'] = $this->logbook_model->fetchIota(); $data['modes'] = $this->modes->active(); @@ -86,7 +87,7 @@ class QSO extends CI_Controller { $data['user_dok_to_qso_tab'] = 0; } - $data['qso_count'] = self::LAST_QSOS_COUNT; + $data['qso_count'] = $this->session->userdata('last_qsos_count'); $this->load->library('form_validation'); @@ -605,7 +606,7 @@ class QSO extends CI_Controller { $this->load->model('logbook_model'); session_write_close(); - $data['query'] = $this->logbook_model->last_custom(self::LAST_QSOS_COUNT); + $data['query'] = $this->logbook_model->last_custom($this->session->userdata('last_qsos_count')); // Load view $this->load->view('qso/components/previous_contacts', $data); diff --git a/application/views/interface_assets/header.php b/application/views/interface_assets/header.php index 0142022fb..de57033d2 100644 --- a/application/views/interface_assets/header.php +++ b/application/views/interface_assets/header.php @@ -63,6 +63,7 @@ $profile_info = $this->stations->profile($actstation)->row(); echo "var activeStationTXPower = '".xss_clean($profile_info->station_power ?? 0)."';\n"; echo "var activeStationOP = '".xss_clean($this->session->userdata('operator_callsign'))."';\n"; + echo "var last_qsos_count = ".$this->session->userdata('last_qsos_count')."\n"; } ?> diff --git a/assets/js/sections/qso.js b/assets/js/sections/qso.js index 009cd1dd9..daf3486bf 100644 --- a/assets/js/sections/qso.js +++ b/assets/js/sections/qso.js @@ -623,7 +623,7 @@ $("#callsign").on("focusout", function () { find_callsign = find_callsign.replaceAll('Ø', '0'); // Replace / in a callsign with - to stop urls breaking - lookupCall = $.getJSON(base_url + 'index.php/logbook/json/' + find_callsign + '/' + json_band + '/' + json_mode + '/' + $('#stationProfile').val() + '/' + $('#start_date').val(), async function (result) { + lookupCall = $.getJSON(base_url + 'index.php/logbook/json/' + find_callsign + '/' + json_band + '/' + json_mode + '/' + $('#stationProfile').val() + '/' + $('#start_date').val() + '/' + last_qsos_count, async function (result) { // Make sure the typed callsign and json result match if ($('#callsign').val().toUpperCase().replaceAll('Ø', '0') == result.callsign) {