From 6b4a09d65368164563b75aeb93d2185be4e3b2c3 Mon Sep 17 00:00:00 2001
From: Andreas <6977712+AndreasK79@users.noreply.github.com>
Date: Fri, 9 Sep 2022 23:11:52 +0200
Subject: [PATCH] [Bands] Editing QSO now fetches bands from DB. Includes also
disabled bands.
---
application/controllers/Qso.php | 4 +-
application/models/Bands.php | 6 ++-
application/views/qso/edit_ajax.php | 84 ++++++++---------------------
assets/js/sections/bands.js | 12 ++++-
4 files changed, 37 insertions(+), 69 deletions(-)
diff --git a/application/controllers/Qso.php b/application/controllers/Qso.php
index f8a11276..491da78d 100755
--- a/application/controllers/Qso.php
+++ b/application/controllers/Qso.php
@@ -20,7 +20,6 @@ class QSO extends CI_Controller {
public function index()
{
-
$this->load->model('cat');
$this->load->model('stations');
$this->load->model('logbook_model');
@@ -40,7 +39,6 @@ class QSO extends CI_Controller {
$data['modes'] = $this->modes->active();
$data['bands'] = $this->bands->get_user_bands_for_qso_entry();
-
$this->load->library('form_validation');
$this->form_validation->set_rules('start_date', 'Date', 'required');
@@ -157,6 +155,7 @@ class QSO extends CI_Controller {
$this->load->model('logbook_model');
$this->load->model('user_model');
$this->load->model('modes');
+ $this->load->model('bands');
$this->load->model('contesting_model');
$this->load->library('form_validation');
@@ -172,6 +171,7 @@ class QSO extends CI_Controller {
$data['dxcc'] = $this->logbook_model->fetchDxcc();
$data['iota'] = $this->logbook_model->fetchIota();
$data['modes'] = $this->modes->all();
+ $data['bands'] = $this->bands->get_user_bands_for_qso_entry(true);
$data['contest'] = $this->contesting_model->getActivecontests();
$this->load->view('qso/edit_ajax', $data);
diff --git a/application/models/Bands.php b/application/models/Bands.php
index d0c52023..8a9b2344 100644
--- a/application/models/Bands.php
+++ b/application/models/Bands.php
@@ -49,11 +49,13 @@ class Bands extends CI_Model {
return $results;
}
- function get_user_bands_for_qso_entry() {
+ function get_user_bands_for_qso_entry($includeall = false) {
$this->db->from('bands');
$this->db->join('bandxuser', 'bandxuser.bandid = bands.id');
$this->db->where('bandxuser.userid', $this->session->userdata('user_id'));
- $this->db->where('bandxuser.active', 1);
+ if (!$includeall) {
+ $this->db->where('bandxuser.active', 1);
+ }
$this->db->where('bands.bandgroup != "sat"');
$result = $this->db->get()->result();
diff --git a/application/views/qso/edit_ajax.php b/application/views/qso/edit_ajax.php
index 21c82fd5..10220922 100644
--- a/application/views/qso/edit_ajax.php
+++ b/application/views/qso/edit_ajax.php
@@ -88,38 +88,16 @@
@@ -127,37 +105,17 @@
diff --git a/assets/js/sections/bands.js b/assets/js/sections/bands.js
index e7ceb41d..98bdab4c 100644
--- a/assets/js/sections/bands.js
+++ b/assets/js/sections/bands.js
@@ -40,7 +40,11 @@ function createBand(form) {
url: base_url + 'index.php/band/create',
type: 'post',
data: {
- 'band': form.band.value
+ 'band': form.band.value,
+ 'bandgroup': form.bandgroup.value,
+ 'ssbqrg': form.ssbqrg.value,
+ 'dataqrg': form.dataqrg.value,
+ 'cwqrg': form.cwqrg.value
},
success: function (html) {
location.reload();
@@ -84,7 +88,11 @@ function saveUpdatedBand(form) {
url: base_url + 'index.php/band/saveupdatedband',
type: 'post',
data: {'id': form.id.value,
- 'band': form.band.value
+ 'band': form.band.value,
+ 'bandgroup': form.bandgroup.value,
+ 'ssbqrg': form.ssbqrg.value,
+ 'dataqrg': form.dataqrg.value,
+ 'cwqrg': form.cwqrg.value
},
success: function (html) {
location.reload();