From 42c24dc402fc099d07b36cb781dc5360ebfe15f0 Mon Sep 17 00:00:00 2001 From: Kim Huebel Date: Sat, 15 Jun 2019 20:20:20 +0200 Subject: [PATCH] Added QSL-Received-Button --- application/controllers/Qso.php | 23 ++++++++++++++++++++++ application/models/Logbook_model.php | 14 +++++++++++++ application/views/view_log/partial/log.php | 2 ++ index.php | 3 ++- 4 files changed, 41 insertions(+), 1 deletion(-) diff --git a/application/controllers/Qso.php b/application/controllers/Qso.php index 349e9c07..da15d933 100755 --- a/application/controllers/Qso.php +++ b/application/controllers/Qso.php @@ -109,6 +109,29 @@ class QSO extends CI_Controller { } } + function qsl_rcvd() { + + $this->load->model('logbook_model'); + $this->load->model('user_model'); + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + $query = $this->logbook_model->qso_info($this->uri->segment(3)); + + $this->load->library('form_validation'); + $this->form_validation->set_rules('id', 'ID', 'required'); + + $data = $query->row(); + if ($this->form_validation->run() == FALSE) + { + $this->load->view('qso/qsl_rcvd', $data); + } + else + { + $this->logbook_model->qsl_rcvd(); + $this->session->set_flashdata('notice', 'QSL registered'); + $this->load->view('qso/qsl_rcvd_done'); + } + } + /* Delete QSO */ function delete($id) { $this->load->model('logbook_model'); diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 115b92b4..0b1bf92c 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -269,6 +269,20 @@ class Logbook_model extends CI_Model { } + + /* QSL received */ + function qsl_rcvd() { + + $data = array( + 'COL_QSLRDATE' => date('Y-m-d'), + 'COL_QSL_RCVD' => "Y" + ); + + $this->db->where('COL_PRIMARY_KEY', $this->input->post('id')); + $this->db->update($this->config->item('table_name'), $data); + + } + /* Return last 10 QSOs */ function last_ten() { $this->db->select('COL_CALL, COL_BAND, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_NAME, COL_COUNTRY, COL_PRIMARY_KEY, COL_SAT_NAME'); diff --git a/application/views/view_log/partial/log.php b/application/views/view_log/partial/log.php index 29474615..124f27db 100644 --- a/application/views/view_log/partial/log.php +++ b/application/views/view_log/partial/log.php @@ -18,6 +18,7 @@ LoTW + @@ -58,6 +59,7 @@ Edit + QSL RCVD config->item('callsign_tags') == true) { ?> COL_STATION_CALLSIGN != null) { ?> COL_STATION_CALLSIGN; ?> diff --git a/index.php b/index.php index 7d8fe56d..93c6cc50 100644 --- a/index.php +++ b/index.php @@ -54,7 +54,8 @@ * NOTE: If you change these, also change the error_reporting() code below */ #define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development'); - define('ENVIRONMENT', 'development'); +# define('ENVIRONMENT', 'development'); + define('ENVIRONMENT', 'production'); /* *---------------------------------------------------------------