From 26cc67a55b5104e107720ebda6be9c03fe73f78f Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Mon, 19 Dec 2022 18:20:55 +0100 Subject: [PATCH] [Logbookadvanced] Added dropdown to choose number of results returned --- application/controllers/Logbookadvanced.php | 1 + application/models/Logbookadvanced_model.php | 6 +----- application/views/logbookadvanced/index.php | 11 ++++++++++- assets/js/sections/logbookadvanced.js | 1 + src/QSLManager/QSO.php | 8 ++++---- 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php index 1a0c8226..ee300a5d 100644 --- a/application/controllers/Logbookadvanced.php +++ b/application/controllers/Logbookadvanced.php @@ -94,6 +94,7 @@ class Logbookadvanced extends CI_Controller { 'propmode' => xss_clean($this->input->post('propmode')), 'gridsquare' => xss_clean($this->input->post('gridsquare')), 'state' => xss_clean($this->input->post('state')), + 'qsoresults' => xss_clean($this->input->post('qsoresults')), ); $qsos = []; diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php index 232b38d2..004f298f 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -114,11 +114,7 @@ class Logbookadvanced_model extends CI_Model { $where = "AND $where"; } - if ($where === '') { - $limit = 250; - } else { - $limit = 1000; - } + $limit = $searchCriteria['qsoresults']; $sql = " SELECT * diff --git a/application/views/logbookadvanced/index.php b/application/views/logbookadvanced/index.php index 5e8f4066..dec78643 100644 --- a/application/views/logbookadvanced/index.php +++ b/application/views/logbookadvanced/index.php @@ -101,7 +101,7 @@
- +
+
+ + +

diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js index f80d638f..1598225c 100644 --- a/assets/js/sections/logbookadvanced.js +++ b/assets/js/sections/logbookadvanced.js @@ -156,6 +156,7 @@ $(document).ready(function () { propmode: this.selectPropagation.value, gridsquare: this.gridsquare.value, state: this.state.value, + qsoresults: this.qsoResults.value }, dataType: 'json', success: function (data) { diff --git a/src/QSLManager/QSO.php b/src/QSLManager/QSO.php index 196241fb..4d08859c 100644 --- a/src/QSLManager/QSO.php +++ b/src/QSLManager/QSO.php @@ -162,10 +162,10 @@ class QSO $this->QSLSentVia = ($data['COL_QSL_SENT_VIA'] === null) ? '' : $data['COL_QSL_SENT_VIA']; $this->QSLVia = ($data['COL_QSL_VIA'] === null) ? '' : $data['COL_QSL_VIA']; - $this->cqzone = $data['COL_CQZ']; - $this->state = $data['COL_STATE']; - $this->dxcc = $data['COL_COUNTRY']; - $this->iota = $data['COL_IOTA']; + $this->cqzone = ($data['COL_CQZ'] === null) ? '' : $data['COL_CQZ']; + $this->state = ($data['COL_STATE'] === null) ? '' :$data['COL_STATE']; + $this->dxcc = ($data['COL_COUNTRY'] === null) ? '' :$data['COL_COUNTRY']; + $this->iota = ($data['COL_IOTA'] === null) ? '' :$data['COL_IOTA']; } /**