From 9d1f30d8e84d9240faffd7cf0ca6e2904c0eb6fb Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Tue, 15 Nov 2022 18:29:33 +0100 Subject: [PATCH 1/5] [OQRS] Added OQRS system --- application/config/migration.php | 2 +- application/controllers/Oqrs.php | 183 +++++++++++++ application/controllers/Qslprint.php | 9 + application/migrations/106_add_oqrs.php | 105 ++++++++ application/models/Bands.php | 45 ++++ application/models/Oqrs_model.php | 250 +++++++++++++++++ application/models/Qslprint_model.php | 12 + application/models/Stations.php | 6 + application/models/User_model.php | 8 + application/views/email/oqrs_request.php | 8 + application/views/interface_assets/footer.php | 30 +++ application/views/interface_assets/header.php | 4 + application/views/oqrs/index.php | 39 +++ application/views/oqrs/notinlogform.php | 43 +++ application/views/oqrs/request.php | 67 +++++ application/views/oqrs/result.php | 36 +++ application/views/oqrs/showoqrs.php | 26 ++ application/views/oqrs/showrequests.php | 126 +++++++++ application/views/station_profile/create.php | 21 ++ application/views/station_profile/edit.php | 31 +++ assets/js/sections/oqrs.js | 254 ++++++++++++++++++ 21 files changed, 1304 insertions(+), 1 deletion(-) create mode 100644 application/controllers/Oqrs.php create mode 100644 application/migrations/106_add_oqrs.php create mode 100644 application/models/Oqrs_model.php create mode 100644 application/views/email/oqrs_request.php create mode 100644 application/views/oqrs/index.php create mode 100644 application/views/oqrs/notinlogform.php create mode 100644 application/views/oqrs/request.php create mode 100644 application/views/oqrs/result.php create mode 100644 application/views/oqrs/showoqrs.php create mode 100644 application/views/oqrs/showrequests.php create mode 100644 assets/js/sections/oqrs.js diff --git a/application/config/migration.php b/application/config/migration.php index 4082bbf7..1533ff2e 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE; | be upgraded / downgraded to. | */ -$config['migration_version'] = 105; +$config['migration_version'] = 106; /* |-------------------------------------------------------------------------- diff --git a/application/controllers/Oqrs.php b/application/controllers/Oqrs.php new file mode 100644 index 00000000..a13f1ddc --- /dev/null +++ b/application/controllers/Oqrs.php @@ -0,0 +1,183 @@ +load->model('user_model'); + // if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + } + + public function index() { + $this->load->model('oqrs_model'); + + $data['stations'] = $this->oqrs_model->get_oqrs_stations(); + $data['page_title'] = "Log Search & OQRS"; + + $this->load->view('interface_assets/header', $data); + $this->load->view('oqrs/index'); + $this->load->view('interface_assets/footer'); + } + + public function get_station_info() { + $this->load->model('oqrs_model'); + $result = $this->oqrs_model->get_station_info($this->input->post('station_id')); + + header('Content-Type: application/json'); + echo json_encode($result); + } + + public function get_qsos() { + $this->load->model('bands'); + $data['bands'] = $this->bands->get_worked_bands_oqrs($this->security->xss_clean($this->input->post('station_id'))); + + $this->load->model('oqrs_model'); + $result = $this->oqrs_model->get_qsos($this->input->post('station_id'), $this->input->post('callsign'), $data['bands']); + $data['callsign'] = $this->security->xss_clean($this->input->post('callsign')); + $data['result'] = $result['qsoarray']; + $data['qsocount'] = $result['qsocount']; + + $this->load->view('oqrs/result', $data); + } + + public function not_in_log() { + $data['page_title'] = "Log Search & OQRS"; + + $this->load->model('bands'); + $data['bands'] = $this->bands->get_worked_bands_oqrs($this->security->xss_clean($this->input->post('station_id'))); + + $this->load->view('oqrs/notinlogform', $data); + } + + public function save_not_in_log() { + $postdata = $this->input->post(); + $this->load->model('oqrs_model'); + $this->oqrs_model->save_not_in_log($postdata); + $this->alert_oqrs_request($postdata); + } + + /* + * Fetches data when the user wants to make a request form, and loads info via the view + */ + public function request_form() { + $this->load->model('oqrs_model'); + $data['result'] = $this->oqrs_model->getQueryData($this->input->post('station_id'), $this->input->post('callsign')); + $data['callsign'] = $this->security->xss_clean($this->input->post('callsign')); + $data['qslinfo'] = $this->oqrs_model->getQslInfo($this->input->post('station_id')); + + $this->load->view('oqrs/request', $data); + } + + public function requests() { + $data['page_title'] = "OQRS Requests"; + + $CI =& get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if ($logbooks_locations_array) { + $location_list = "'".implode("','",$logbooks_locations_array)."'"; + } else { + $location_list = null; + } + + $this->load->model('oqrs_model'); + $data['result'] = $this->oqrs_model->getOqrsRequests($location_list); + + $this->load->view('interface_assets/header', $data); + $this->load->view('oqrs/showrequests'); + $this->load->view('interface_assets/footer'); + } + + public function save_oqrs_request() { + $postdata = $this->input->post(); + $this->load->model('oqrs_model'); + $this->oqrs_model->save_oqrs_request($postdata); + $this->alert_oqrs_request($postdata); + } + + public function delete_oqrs_line() { + $id = $this->input->post('id'); + $this->load->model('oqrs_model'); + $this->oqrs_model->delete_oqrs_line($id); + } + + public function search_log() { + $this->load->model('oqrs_model'); + $callsign = $this->input->post('callsign'); + + $data['qsos'] = $this->oqrs_model->search_log($this->security->xss_clean($callsign)); + + $this->load->view('qslprint/qsolist', $data); + } + + public function search_log_time_date() { + $this->load->model('oqrs_model'); + $time = $this->security->xss_clean($this->input->post('time')); + $date = $this->security->xss_clean($this->input->post('date')); + $mode = $this->security->xss_clean($this->input->post('mode')); + $band = $this->security->xss_clean($this->input->post('band')); + + $data['qsos'] = $this->oqrs_model->search_log_time_date($time, $date, $band, $mode); + + $this->load->view('qslprint/qsolist', $data); + } + + public function alert_oqrs_request($postdata) { + $this->load->model('user_model'); + + $email = $this->user_model->get_email_address($this->session->userdata('user_id')); + + $this->load->model('oqrs_model'); + + $sendEmail = $this->oqrs_model->getOqrsEmailSetting($this->security->xss_clean($this->input->post('station_id'))); + + if($email != "" && $sendEmail == "1") { + + $this->load->library('email'); + + if($this->optionslib->get_option('emailProtocol') == "smtp") { + $config = Array( + 'protocol' => $this->optionslib->get_option('emailProtocol'), + 'smtp_host' => $this->optionslib->get_option('smtpHost'), + 'smtp_port' => $this->optionslib->get_option('smtpPort'), + 'smtp_user' => $this->optionslib->get_option('smtpUsername'), + 'smtp_pass' => $this->optionslib->get_option('smtpPassword'), + 'crlf' => "\r\n", + 'newline' => "\r\n" + ); + + $this->email->initialize($config); + } + + $data['callsign'] = $this->security->xss_clean($postdata['callsign']); + + $message = $this->load->view('email/oqrs_request', $data, TRUE); + + $this->email->from('noreply@cloudlog.co.uk', 'Cloudlog'); + $this->email->to($email); + + $this->email->subject('Cloudlog OQRS from ' . strtoupper($data['callsign'])); + $this->email->message($message); + + if (! $this->email->send()) { + $this->session->set_flashdata('warning', 'Email settings are incorrect.'); + } else { + $this->session->set_flashdata('notice', 'Password Reset Processed.'); + } + } + } + + public function mark_oqrs_line_as_done() { + $this->load->model('oqrs_model'); + $id = $this->security->xss_clean($this->input->post('id')); + + $this->oqrs_model->mark_oqrs_line_as_done($id); + } +} diff --git a/application/controllers/Qslprint.php b/application/controllers/Qslprint.php index bb65ba2d..3db6ce3e 100644 --- a/application/controllers/Qslprint.php +++ b/application/controllers/Qslprint.php @@ -176,6 +176,15 @@ class QSLPrint extends CI_Controller { $this->qslprint_model->add_qso_to_print_queue($this->security->xss_clean($id)); } + public function show_oqrs() { + $id = $this->security->xss_clean($this->input->post('id')); + + $this->load->model('qslprint_model'); + + $data['result'] = $this->qslprint_model->show_oqrs($id); + $this->load->view('oqrs/showoqrs', $data); + } + } /* End of file Qslprint.php */ diff --git a/application/migrations/106_add_oqrs.php b/application/migrations/106_add_oqrs.php new file mode 100644 index 00000000..c1d78182 --- /dev/null +++ b/application/migrations/106_add_oqrs.php @@ -0,0 +1,105 @@ +db->field_exists('oqrs', 'station_profile')) { + $fields = array( + 'oqrs int DEFAULT 0', + ); + + $this->dbforge->add_column('station_profile', $fields); + } + + if (!$this->db->field_exists('oqrs_text', 'station_profile')) { + $fields = array( + 'oqrs_text text DEFAULT ""', + ); + + $this->dbforge->add_column('station_profile', $fields); + } + + if (!$this->db->field_exists('oqrs_email', 'station_profile')) { + $fields = array( + 'oqrs_email int DEFAULT 0', + ); + + $this->dbforge->add_column('station_profile', $fields); + } + + if (!$this->db->table_exists('oqrs')) { + $this->dbforge->add_field(array( + 'id' => array( + 'type' => 'INT', + 'constraint' => 20, + 'unsigned' => TRUE, + 'auto_increment' => TRUE, + 'unique' => TRUE + ), + 'requesttime' => array( + 'type' => 'timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', + ), + 'date' => array( + 'type' => 'date', + ), + 'time' => array( + 'type' => 'time', + ), + 'band' => array( + 'type' => 'VARCHAR', + 'constraint' => 10, + ), + 'mode' => array( + 'type' => 'VARCHAR', + 'constraint' => 12, + ), + 'requestcallsign' => array( + 'type' => 'VARCHAR', + 'constraint' => 32, + ), + 'station_id' => array( + 'type' => 'int', + ), + 'note' => array( + 'type' => 'TEXT', + ), + 'email' => array( + 'type' => 'TEXT', + ), + 'qslroute' => array( + 'type' => 'VARCHAR', + 'constraint' => 50, + ), + 'status' => array( + 'type' => 'int', + ), + 'qsoid' => array( + 'type' => 'int', + ) + )); + + $this->dbforge->add_key('id', TRUE); + + $this->dbforge->create_table('oqrs'); + } + } + + public function down() + { + if ($this->db->field_exists('oqrs', 'station_profile')) { + $this->dbforge->drop_column('station_profile', 'oqrs'); + } + if ($this->db->field_exists('oqrs_text', 'station_profile')) { + $this->dbforge->drop_column('station_profile', 'oqrs_text'); + } + + if ($this->db->field_exists('oqrs_email', 'station_profile')) { + $this->dbforge->drop_column('station_profile', 'oqrs_email'); + } + + $this->dbforge->drop_table('oqrs'); + } +} \ No newline at end of file diff --git a/application/models/Bands.php b/application/models/Bands.php index f8eee324..78e0d13c 100644 --- a/application/models/Bands.php +++ b/application/models/Bands.php @@ -315,6 +315,51 @@ class Bands extends CI_Model { return true; } + + function get_worked_bands_oqrs($station_id) { + + // get all worked slots from database + $data = $this->db->query( + "SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `".$this->config->item('table_name')."` WHERE station_id in (" . $station_id . ") AND COL_PROP_MODE != \"SAT\"" + ); + $worked_slots = array(); + foreach($data->result() as $row){ + array_push($worked_slots, $row->COL_BAND); + } + + $SAT_data = $this->db->query( + "SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `".$this->config->item('table_name')."` WHERE station_id in (" . $station_id . ") AND COL_PROP_MODE = \"SAT\"" + ); + + foreach($SAT_data->result() as $row){ + array_push($worked_slots, strtoupper($row->COL_PROP_MODE)); + } + + // php5 + usort( + $worked_slots, + function($b, $a) { + sscanf($a, '%f%s', $ac, $ar); + sscanf($b, '%f%s', $bc, $br); + if ($ar == $br) { + return ($ac < $bc) ? -1 : 1; + } + return ($ar < $br) ? -1 : 1; + } + ); + + // Only for php7+ + // usort( + // $worked_slots, + // function($b, $a) { + // sscanf($a, '%f%s', $ac, $ar); + // sscanf($b, '%f%s', $bc, $br); + // return ($ar == $br) ? $ac <=> $bc : $ar <=> $br; + // } + // ); + + return $worked_slots; + } } ?> \ No newline at end of file diff --git a/application/models/Oqrs_model.php b/application/models/Oqrs_model.php new file mode 100644 index 00000000..a4508eac --- /dev/null +++ b/application/models/Oqrs_model.php @@ -0,0 +1,250 @@ +db->where('oqrs', "1"); + return $this->db->get('station_profile'); + } + + function get_station_info($station_id) { + $station_id = $this->security->xss_clean($station_id); + + $sql = 'select + count(*) as count, + min(col_time_on) as mindate, + max(col_time_on) as maxdate + from ' . $this->config->item('table_name') . ' where station_id = ' . $station_id; + + $query = $this->db->query($sql); + + return $query->row(); + } + + function get_qsos($station_id, $callsign, $bands){ + $modes = $this->get_worked_modes($station_id); + + // Creating an empty array with all the bands and modes from the database + foreach ($modes as $mode) { + foreach ($bands as $band) { + $resultArray[$mode][$band] = '-'; + } + } + + // Populating array with worked band/mode combinations + $worked = $this->getQueryData($station_id, $callsign); + foreach ($worked as $w) { + $resultArray[$w->col_mode][$w->col_band] = ''; + } + + $result['qsocount'] = count($worked); + $result['qsoarray'] = $resultArray; + + return $result; + } + + /* + * Builds query depending on what we are searching for + */ + function getQueryData($station_id, $callsign) { + $station_id = $this->security->xss_clean($station_id); + $callsign = $this->security->xss_clean($callsign); + $sql = 'select lower(col_mode) col_mode, coalesce(col_submode, "") col_submode, col_band from ' . $this->config->item('table_name') . ' where station_id = ' . $station_id . ' and col_call ="' . $callsign . '"'; + + $query = $this->db->query($sql); + + return $query->result(); + } + + /* + * Get's the worked modes from the log + */ + function get_worked_modes($station_id) + { + // get all worked modes from database + $data = $this->db->query( + "SELECT distinct LOWER(`COL_MODE`) as `COL_MODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $station_id . ") order by COL_MODE ASC" + ); + $results = array(); + foreach ($data->result() as $row) { + array_push($results, $row->COL_MODE); + } + + $data = $this->db->query( + "SELECT distinct LOWER(`COL_SUBMODE`) as `COL_SUBMODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $station_id . ") and coalesce(COL_SUBMODE, '') <> '' order by COL_SUBMODE ASC" + ); + foreach ($data->result() as $row) { + if (!in_array($row, $results)) { + array_push($results, $row->COL_SUBMODE); + } + } + + return $results; + } + + function getOqrsRequests($location_list) { + $sql = 'select * from oqrs join station_profile on oqrs.station_id = station_profile.station_id where oqrs.station_id in (' . $location_list . ') and oqrs.status < 2'; + + $query = $this->db->query($sql); + + return $query->result(); + } + + function save_oqrs_request($postdata) { + $qsos = $postdata['qsos']; + foreach($qsos as $qso) { + $data = array( + 'date' => xss_clean($qso[0]), + 'time' => xss_clean($qso[1]), + 'band' => xss_clean($qso[2]), + 'mode' => xss_clean($qso[3]), + 'requestcallsign' => xss_clean($postdata['callsign']), + 'station_id' => xss_clean($postdata['station_id']), + 'note' => xss_clean($postdata['message']), + 'email' => xss_clean($postdata['email']), + 'qslroute' => xss_clean($postdata['qslroute']), + 'status' => '0', + ); + + $qsoid = $this->check_oqrs($data); + + if ($qsoid > 0) { + $data['status'] = '2'; + $data['qsoid'] = $qsoid; + } + + $this->db->insert('oqrs', $data); + } + } + + function delete_oqrs_line($id) { + $sql = 'delete from oqrs where id =' . xss_clean($id); + + $query = $this->db->query($sql); + + return true; + } + + + // Status: + // 0 = open request + // 1 = not in log request + // 2 = request done, means we found a match in the log + function save_not_in_log($postdata) { + $qsos = $postdata['qsos']; + foreach($qsos as $qso) { + $data = array( + 'date' => xss_clean($qso[0]), + 'time' => xss_clean($qso[1]), + 'band' => xss_clean($qso[2]), + 'mode' => xss_clean($qso[3]), + 'requestcallsign' => xss_clean($postdata['callsign']), + 'station_id' => xss_clean($postdata['station_id']), + 'note' => xss_clean($postdata['message']), + 'email' => xss_clean($postdata['email']), + 'qslroute' => '', + 'status' => '1', + ); + + $this->db->insert('oqrs', $data); + } + } + + function check_oqrs($qsodata) { + $sql = 'select * from ' . $this->config->item('table_name') . + ' where col_band = \'' . $qsodata['band'] . '\' + and col_call = \'' . $qsodata['requestcallsign'] . '\' + and date(col_time_on) = \'' . $qsodata['date'] . '\' + and (col_mode = \'' . $qsodata['mode'] . '\' + or col_submode = \'' . $qsodata['mode'] . '\') + and timediff(time(col_time_on), \'' . $qsodata['time'] . '\') <= 3000 + and station_id = ' . $qsodata['station_id']; + + $query = $this->db->query($sql); + + if ($result = $query->result()) { + $id = 0; + foreach ($result as $qso) { + $this->paperqsl_requested($qso->COL_PRIMARY_KEY, $qsodata['qslroute']); + $id = $qso->COL_PRIMARY_KEY; + } + return $id; + } + + return 0; + } + + // Set Paper to requested + function paperqsl_requested($qso_id, $method) { + + $data = array( + 'COL_QSLSDATE' => date('Y-m-d H:i:s'), + 'COL_QSL_SENT' => 'R', + 'COL_QSL_SENT_VIA ' => $method + ); + + $this->db->where('COL_PRIMARY_KEY', $qso_id); + + $this->db->update($this->config->item('table_name'), $data); + } + + function search_log($callsign) { + $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); + // always filter user. this ensures that no inaccesible QSOs will be returned + $this->db->where('station_profile.user_id', $this->session->userdata('user_id')); + $this->db->where('COL_CALL like "%'.$callsign.'%"'); + $this->db->order_by("COL_TIME_ON", "ASC"); + $query = $this->db->get($this->config->item('table_name')); + + return $query; + } + + function search_log_time_date($time, $date, $band, $mode) { + $sql = 'select * from ' . $this->config->item('table_name') . ' thcv + join station_profile on thcv.station_id = station_profile.station_id where col_band = \'' . $band . '\' + and date(col_time_on) = \'' . $date . '\' + and (col_mode = \'' . $mode . '\' + or col_submode = \'' . $mode . '\') + and timediff(time(col_time_on), \'' . $time . '\') <= 3000 + and station_profile.user_id = '. $this->session->userdata('user_id'); + + return $this->db->query($sql);; + } + + function mark_oqrs_line_as_done($id) { + $data = array( + 'status' => '2', + ); + + $this->db->where('id', $id); + + $this->db->update('oqrs', $data); + } + + function getQslInfo($station_id) { + $sql = 'select oqrs_text from station_profile where station_id = ' . $station_id; + + $query = $this->db->query($sql); + + if ($query->num_rows() > 0) + { + $row = $query->row(); + return $row->oqrs_text; + } + + return ''; + } + + function getOqrsEmailSetting($station_id) { + $sql = 'select oqrs_email from station_profile where station_id = ' . $station_id; + + $query = $this->db->query($sql); + + if ($query->num_rows() > 0) + { + $row = $query->row(); + return $row->oqrs_email; + } + + return ''; + } +} \ No newline at end of file diff --git a/application/models/Qslprint_model.php b/application/models/Qslprint_model.php index 4e5ea0df..f73ba0c6 100644 --- a/application/models/Qslprint_model.php +++ b/application/models/Qslprint_model.php @@ -49,6 +49,7 @@ class Qslprint_model extends CI_Model { } $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); + $this->db->join('oqrs', 'oqrs.qsoid = '.$this->config->item('table_name').'.COL_PRIMARY_KEY', 'left outer'); // always filter user. this ensures that even if the station_id is from another user no inaccesible QSOs will be returned $this->db->where('station_profile.user_id', $this->session->userdata('user_id')); $this->db->where_in('COL_QSL_SENT', array('R', 'Q')); @@ -112,6 +113,17 @@ class Qslprint_model extends CI_Model { return $query; } + function show_oqrs($id) { + $this->db->select('requesttime as "Request time", requestcallsign as "Requester", email as "Email", note as "Note"'); + $this->db->join('station_profile', 'station_profile.station_id = oqrs.station_id'); + // always filter user. this ensures that no inaccesible QSOs will be returned + $this->db->where('station_profile.user_id', $this->session->userdata('user_id')); + $this->db->where('oqrs.id = ' .$id); + $query = $this->db->get('oqrs'); + + return $query->result(); + } + } ?> diff --git a/application/models/Stations.php b/application/models/Stations.php index 07bd4b7a..d2da749b 100644 --- a/application/models/Stations.php +++ b/application/models/Stations.php @@ -77,6 +77,9 @@ class Stations extends CI_Model { 'eqslqthnickname' => xss_clean($this->input->post('eqslnickname', true)), 'qrzapikey' => xss_clean($this->input->post('qrzapikey', true)), 'qrzrealtime' => xss_clean($this->input->post('qrzrealtime', true)), + 'oqrs' => xss_clean($this->input->post('oqrs', true)), + 'oqrs_email' => xss_clean($this->input->post('oqrsemail', true)), + 'oqrs_text' => xss_clean($this->input->post('oqrstext', true)), ); // Insert Records @@ -103,6 +106,9 @@ class Stations extends CI_Model { 'eqslqthnickname' => xss_clean($this->input->post('eqslnickname', true)), 'qrzapikey' => xss_clean($this->input->post('qrzapikey', true)), 'qrzrealtime' => xss_clean($this->input->post('qrzrealtime', true)), + 'oqrs' => xss_clean($this->input->post('oqrs', true)), + 'oqrs_email' => xss_clean($this->input->post('oqrsemail', true)), + 'oqrs_text' => xss_clean($this->input->post('oqrstext', true)), ); $this->db->where('user_id', $this->session->userdata('user_id')); diff --git a/application/models/User_model.php b/application/models/User_model.php index ae8053a9..92f148ff 100644 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -76,6 +76,14 @@ class User_Model extends CI_Model { } } + function get_email_address($userid) { + $this->db->where('user_id', $userid); + $query = $this->db->get($this->config->item('auth_table')); + + $ret = $query->row(); + return $ret->user_email; + } + // FUNCTION: bool exists($username) // Check if a user exists (by username) function exists($username) { diff --git a/application/views/email/oqrs_request.php b/application/views/email/oqrs_request.php new file mode 100644 index 00000000..1518fc85 --- /dev/null +++ b/application/views/email/oqrs_request.php @@ -0,0 +1,8 @@ +Hi, + +You got an OQRS request from . +Please log into your Cloudlog and process it. + +Regards, + +Cloudlog. \ No newline at end of file diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 5eb8d9a3..a23c457e 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -39,6 +39,10 @@ function load_was_map() { +uri->segment(1) == "oqrs") { ?> + + + uri->segment(1) == "awards" && ($this->uri->segment(2) == "cq") ) { ?> @@ -3032,6 +3036,32 @@ function deleteQsl(id) { } }); }); + + function showOqrs(id) { + $.ajax({ + url: base_url + 'index.php/qslprint/show_oqrs', + type: 'post', + data: {'id': id}, + success: function(html) { + BootstrapDialog.show({ + title: 'OQRS', + size: BootstrapDialog.SIZE_WIDE, + cssClass: 'qso-dialog', + nl2br: false, + message: html, + onshown: function(dialog) { + $('[data-toggle="tooltip"]').tooltip(); + }, + buttons: [{ + label: 'Close', + action: function (dialogItself) { + dialogItself.close(); + } + }] + }); + } + }); + } diff --git a/application/views/interface_assets/header.php b/application/views/interface_assets/header.php index 7f55ea71..17baa366 100644 --- a/application/views/interface_assets/header.php +++ b/application/views/interface_assets/header.php @@ -214,6 +214,10 @@ Print Requested QSLs + OQRS + + OQRS Requests + KML Export DX Atlas Gridsquare Export diff --git a/application/views/oqrs/index.php b/application/views/oqrs/index.php new file mode 100644 index 00000000..29ad2ea4 --- /dev/null +++ b/application/views/oqrs/index.php @@ -0,0 +1,39 @@ +
+ +
+ +

+ +
+
+ Request a QSL card +
+
+ + + '; + if ($stations->result() != NULL) { ?> + +
+ + + +
+ +
+
+ + + +
+
+
\ No newline at end of file diff --git a/application/views/oqrs/notinlogform.php b/application/views/oqrs/notinlogform.php new file mode 100644 index 00000000..6d6f079a --- /dev/null +++ b/application/views/oqrs/notinlogform.php @@ -0,0 +1,43 @@ +
+If you can't find your QSO in the log, please fill out the form below. You will be contacted after the log has been +checked.
+ + + + + + + + + + + + + + + + + + + +
#DateTime (UTC)BandMode
1
+ +
+
+
+ + + Any extra information we need to know about? +
+ +
+ + + Your e-mail address where we can contact you +
+ + + +
\ No newline at end of file diff --git a/application/views/oqrs/request.php b/application/views/oqrs/request.php new file mode 100644 index 00000000..95885a54 --- /dev/null +++ b/application/views/oqrs/request.php @@ -0,0 +1,67 @@ + +QSL information

'; + echo $qslinfo; + echo '
'; +} +?> +
+The following QSO(s) were found. Please fill out the date and time and submit your request. + + + + + + + + + + + + '; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + } + ?> + +
#DateTime (UTC)BandMode
'. $i++ .''. $qso->col_band .''; echo $qso->col_submode == null ? strtoupper($qso->col_mode) : strtoupper($qso->col_submode); echo '
+
+ +
+
+ +
+ +
+ + +
+ +
+ + +
+

+
+ + + Any extra information we need to know about? +
+ +
+ + + Your e-mail address where we can contact you +
+ + +
\ No newline at end of file diff --git a/application/views/oqrs/result.php b/application/views/oqrs/result.php new file mode 100644 index 00000000..814e3123 --- /dev/null +++ b/application/views/oqrs/result.php @@ -0,0 +1,36 @@ + 0) { +$count = 0; +echo '
Log search result for ' . strtoupper($callsign) . ':
'; +echo ' + + + + '; + foreach($bands as $band) { + echo ''; + } + echo ' + + '; +foreach ($result as $mode => $value) { + echo ' + '; + foreach ($value as $key => $val) { + echo ''; + if ($val != '-') { + $count++; + } + } + echo ''; +} +echo '
' . $band . '
'. strtoupper($mode) .'' . $val . '
'; +echo strtoupper($callsign) . ' has ' . $count . ' band slot(s) and has ' . $qsocount . ' QSO(s) in the log.

'; +?> + +No QSOs found in the log.
'; +} + ?> + \ No newline at end of file diff --git a/application/views/oqrs/showoqrs.php b/application/views/oqrs/showoqrs.php new file mode 100644 index 00000000..e844899a --- /dev/null +++ b/application/views/oqrs/showoqrs.php @@ -0,0 +1,26 @@ +'; + + // Table header + foreach ($table[0] as $key=>$value) { + echo "".$key.""; + } + + // Table body + foreach ($table as $value) { + echo ""; + foreach ($value as $val) { + echo "".$val.""; + } + echo ""; + } + echo ""; +} + +?> \ No newline at end of file diff --git a/application/views/oqrs/showrequests.php b/application/views/oqrs/showrequests.php new file mode 100644 index 00000000..cdd18674 --- /dev/null +++ b/application/views/oqrs/showrequests.php @@ -0,0 +1,126 @@ +
+
+

+ 0) { + $station_id = ''; + $tablebody = ''; + $requester = ''; + $first = true; + $second = true; + foreach ($result as $qso) { + if ($station_id != $qso->station_id) { + if (!$first) { + write_table($tablebody); + $tablebody = ''; + echo '

'; + } + insert_station_data($qso); + $first = false; + } + if ($requester != $qso->requestcallsign) { + if (!$second) { + write_table($tablebody); + } + $second = false; + insert_requester($qso); + write_table_header(); + $tablebody = ''; + } + $tablebody .= insert_qso_data($qso); + + $requester = $qso->requestcallsign; + $station_id = $qso->station_id; + } + write_table($tablebody); + echo '
'; + } else { + echo 'No OQRS requests were found at this time.'; + } + ?> + + + + + +
+
+ Station id: station_id; ?> + Station callsign: station_callsign; ?> + Profile Name: station_profile_name; ?> + Country: station_country; ?> + Gridsquare: station_gridsquare; ?> +
+
+ +OQRS Request: + + + + + + + + + + + + + + + + + + + +
RequesterTime of requestE-mailNoteQSL route
requestcallsign ?>requesttime ?>email ?>note ?>qslroute; ?>
+ id.'"> + ' . $qso->date . ' + ' . $qso->time . ' + ' . $qso->band . ' + ' . $qso->mode . ' + + + + + + '; + return $tablebody; +} + +function write_table_header() { + ?> + + + + + + + + + + + + + + + +
DateTime (UTC)BandModeCheck logMark as doneDelete
+
+
+ + +
+
+ + + Make sure email is set up under admin and global options. +
+
+ + + Some info you want to add regarding QSL'ing. +
+ diff --git a/application/views/station_profile/edit.php b/application/views/station_profile/edit.php index 38ae078f..7cc944a3 100644 --- a/application/views/station_profile/edit.php +++ b/application/views/station_profile/edit.php @@ -341,6 +341,37 @@
+ + +
+
+
+
OQRS
+
+
+ + +
+
+ + + Make sure email is set up under admin and global options. +
+
+ + oqrs_text; } ?>"> + Some info you want to add regarding QSL'ing. +
+ +
+
+
diff --git a/assets/js/sections/oqrs.js b/assets/js/sections/oqrs.js new file mode 100644 index 00000000..9a49ce6e --- /dev/null +++ b/assets/js/sections/oqrs.js @@ -0,0 +1,254 @@ +function loadStationInfo() { + $(".stationinfo").empty(); + $(".searchinfo").empty(); + $.ajax({ + url: base_url+'index.php/oqrs/get_station_info', + type: 'post', + data: {'station_id': $("#station").val()}, + success: function (data) { + if (data.count > 0) { + $(".stationinfo").append('
' + data.count + ' Qsos logged between ' + data.mindate + ' and ' + data.maxdate + '.

'); + $(".stationinfo").append('
'); + } else { + $(".stationinfo").append("No QSOs for this callsign was found!"); + } + } + }); +} + +function searchOqrs() { + $(".searchinfo").empty(); + $.ajax({ + url: base_url+'index.php/oqrs/get_qsos', + type: 'post', + data: {'station_id': $("#station").val(), 'callsign': $("#oqrssearch").val()}, + success: function (data) { + $(".searchinfo").append(data); + } + }); +} + +function notInLog() { + $.ajax({ + url: base_url + 'index.php/oqrs/not_in_log', + type: 'post', + data: {'station_id': $("#station").val(), 'callsign': $("#oqrssearch").val()}, + success: function(html) { + $(".searchinfo").html(html); + } + }); +} + +function saveNotInLogRequest() { + $(".alertinfo").remove(); + if ($("#emailInput").val() == '') { + $(".searchinfo").prepend('

×You need to fill out an email address!
'); + } else { + const qsos = []; + $(".notinlog-table tbody tr").each(function(i) { + var data = []; + var datecell = $("#date", this).val(); + var timecell = $("#time", this).val(); + var bandcell = $("#band", this).val(); + var modecell = $("#mode", this).val(); + if (datecell != "" && timecell != "" && bandcell != "" && modecell != "") { + data.push(datecell); + data.push(timecell); + data.push(bandcell); + data.push(modecell); + qsos.push(data); + } + }); + if (qsos.length === 0) { + $(".searchinfo").prepend('

×You need to fill the QSO information before submitting a request!
'); + } else { + $.ajax({ + url: base_url+'index.php/oqrs/save_not_in_log', + type: 'post', + data: { 'station_id': $("#station").val(), + 'callsign': $("#oqrssearch").val(), + 'email': $("#emailInput").val(), + 'message': $("#messageInput").val(), + 'qsos': qsos + }, + success: function (data) { + $(".stationinfo").empty(); + $(".searchinfo").empty(); + $(".stationinfo").append('
×Your not in log query has been saved!
'); + } + }); + } + } +} + +function oqrsAddLine() { + var rowCount = $('.notinlog-table tr').length; + var $myTable = $('.notinlog-table'); + + var $row = $(''); + + var $iterator = $('').html(rowCount); + var $date = $('').html(''); + var $time = $('').html(''); + var $band = $('').html(''); + var $mode = $('').html(''); + + $row.append($iterator, $date, $time, $band, $mode); + + $myTable.append($row); +} + +function requestOqrs() { + $.ajax({ + url: base_url + 'index.php/oqrs/request_form', + type: 'post', + data: {'station_id': $("#station").val(), 'callsign': $("#oqrssearch").val()}, + success: function(html) { + $(".searchinfo").html(html); + $('.result-table').DataTable({ + "pageLength": 25, + responsive: false, + ordering: false, + "scrollY": "410px", + "scrollCollapse": true, + "paging": false, + "scrollX": true, + }); + } + }); +} + +function submitOqrsRequest() { + $(".alertinfo").remove(); + if ($("#emailInput").val() == '') { + $(".searchinfo").prepend('

×You need to fill out an email address!
'); + } else { + const qsos = []; + $(".result-table tbody tr").each(function(i) { + var data = []; + var datecell = $("#date", this).val(); + var timecell = $("#time", this).val(); + var bandcell = $("#band", this).text(); + var modecell = $("#mode", this).text(); + if (datecell != "" && timecell != "") { + data.push(datecell); + data.push(timecell); + data.push(bandcell); + data.push(modecell); + qsos.push(data); + } + }); + + if (qsos.length === 0) { + $(".searchinfo").prepend('

×You need to fill the QSO information before submitting a request!
'); + } else { + $.ajax({ + url: base_url+'index.php/oqrs/save_oqrs_request', + type: 'post', + data: { 'station_id': $("#station").val(), + 'callsign': $("#oqrssearch").val(), + 'email': $("#emailInput").val(), + 'message': $("#messageInput").val(), + 'qsos': qsos, + 'qslroute': $('input[name="qslroute"]:checked').val() + }, + success: function (data) { + $(".stationinfo").empty(); + $(".searchinfo").empty(); + $(".stationinfo").append('
×Your QSL request has been saved!
'); + } + }); + } + } +} + +function deleteOqrsLine(id) { + BootstrapDialog.confirm({ + title: 'DANGER', + message: 'Warning! Are you sure you want to delete this OQRS request?', + type: BootstrapDialog.TYPE_DANGER, + closable: true, + draggable: true, + btnOKClass: 'btn-danger', + callback: function (result) { + $.ajax({ + url: base_url+'index.php/oqrs/delete_oqrs_line', + type: 'post', + data: { 'id': id, + }, + success: function (data) { + $(".oqrsid_"+id).remove(); + } + }); + } + }); +} + +function searchLog(callsign) { + $.ajax({ + url: base_url + 'index.php/oqrs/search_log', + type: 'post', + data: {'callsign': callsign, + }, + success: function(html) { + BootstrapDialog.show({ + title: 'QSO List', + size: BootstrapDialog.SIZE_WIDE, + cssClass: 'qso-dialog', + nl2br: false, + message: html, + onshown: function(dialog) { + $('[data-toggle="tooltip"]').tooltip(); + }, + buttons: [{ + label: 'Close', + action: function (dialogItself) { + dialogItself.close(); + } + }] + }); + } + }); +} + +function searchLogTimeDate(id) { + $.ajax({ + url: base_url + 'index.php/oqrs/search_log_time_date', + type: 'post', + data: {'time': $('.oqrsid_'+id+ ' td:nth-child(2)').text(), + 'date': $('.oqrsid_'+id+ ' td:nth-child(1)').text(), + 'band': $('.oqrsid_'+id+ ' td:nth-child(3)').text(), + 'mode': $('.oqrsid_'+id+ ' td:nth-child(4)').text() + }, + success: function(html) { + BootstrapDialog.show({ + title: 'QSO List', + size: BootstrapDialog.SIZE_WIDE, + cssClass: 'qso-dialog', + nl2br: false, + message: html, + onshown: function(dialog) { + $('[data-toggle="tooltip"]').tooltip(); + }, + buttons: [{ + label: 'Close', + action: function (dialogItself) { + dialogItself.close(); + } + }] + }); + } + }); +} + +function markOqrsLineAsDone(id) { + $.ajax({ + url: base_url+'index.php/oqrs/mark_oqrs_line_as_done', + type: 'post', + data: { 'id': id, + }, + success: function (data) { + $(".oqrsid_"+id).remove(); + } + }); +} \ No newline at end of file From ca23cf8b0b8dd6f792258c5c8abd2f5c501c00b6 Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Wed, 14 Dec 2022 12:35:48 +0100 Subject: [PATCH 2/5] [OQRS] Added it's own view for the QSO lookup --- application/controllers/Oqrs.php | 2 +- application/views/oqrs/qsolist.php | 171 +++++++++++++++++++++++++++++ 2 files changed, 172 insertions(+), 1 deletion(-) create mode 100644 application/views/oqrs/qsolist.php diff --git a/application/controllers/Oqrs.php b/application/controllers/Oqrs.php index a13f1ddc..a021d763 100644 --- a/application/controllers/Oqrs.php +++ b/application/controllers/Oqrs.php @@ -126,7 +126,7 @@ class Oqrs extends CI_Controller { $data['qsos'] = $this->oqrs_model->search_log_time_date($time, $date, $band, $mode); - $this->load->view('qslprint/qsolist', $data); + $this->load->view('oqrs/qsolist', $data); } public function alert_oqrs_request($postdata) { diff --git a/application/views/oqrs/qsolist.php b/application/views/oqrs/qsolist.php new file mode 100644 index 00000000..cf79fcf6 --- /dev/null +++ b/application/views/oqrs/qsolist.php @@ -0,0 +1,171 @@ +result() != NULL) { + echo ' + + + + + + + + + '; + if ($this->session->userdata('user_eqsl_name') != "") { + echo ''; + } + if($this->session->userdata('user_lotw_name') != "") { + echo ''; + } + echo ' + + '; + + // Get Date format + if($this->session->userdata('user_date_format')) { + // If Logged in and session exists + $custom_date_format = $this->session->userdata('user_date_format'); + } else { + // Get Default date format from /config/cloudlog.php + $custom_date_format = $this->config->item('qso_date_format'); + } + + foreach ($qsos->result() as $qsl) { + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + } + if($this->session->userdata('user_lotw_name') != "") { + echo ''; + } + echo ''; + echo ''; + } + + echo '
'.$this->lang->line('gen_hamradio_callsign').'' . $this->lang->line('general_word_date') . ''. $this->lang->line('general_word_time') .'' . $this->lang->line('gen_hamradio_mode') . '' . $this->lang->line('gen_hamradio_band') . '' . $this->lang->line('gen_hamradio_station') . 'QSLeQSLLoTW
' . $qsl->COL_CALL . ''; $timestamp = strtotime($qsl->COL_TIME_ON); echo date($custom_date_format, $timestamp); echo ''; $timestamp = strtotime($qsl->COL_TIME_ON); echo date('H:i', $timestamp); echo ''; echo $qsl->COL_SUBMODE==null?$qsl->COL_MODE:$qsl->COL_SUBMODE; echo ''; if($qsl->COL_SAT_NAME != null) { echo $qsl->COL_SAT_NAME; } else { echo strtolower($qsl->COL_BAND); }; echo '' . $qsl->station_callsign . ''; + echo 'COL_QSL_SENT != "N") { + $timestamp = strtotime($qsl->COL_QSLSDATE); + switch ($qsl->COL_QSL_SENT) { + case "Y": + echo "class=\"qsl-green\" data-toggle=\"tooltip\" data-original-title=\"".$this->lang->line('general_word_sent')." ".date($custom_date_format,$timestamp); + break; + case "Q": + echo "class=\"qsl-yellow\" data-toggle=\"tooltip\" data-original-title=\"".$this->lang->line('general_word_queued')." ".date($custom_date_format,$timestamp); + break; + case "R": + echo "class=\"qsl-yellow\" data-toggle=\"tooltip\" data-original-title=\"".$this->lang->line('general_word_requested')." ".date($custom_date_format,$timestamp); + break; + case "I": + echo "class=\"qsl-grey\" data-toggle=\"tooltip\" data-original-title=\"".$this->lang->line('general_word_invalid_ignore')." ".date($custom_date_format,$timestamp); + break; + default: + echo "class=\"qsl-red"; + break; + } + } else { echo "class=\"qsl-red"; } + if ($qsl->COL_QSL_SENT_VIA != "") { + switch ($qsl->COL_QSL_SENT_VIA) { + case "B": + echo " (".$this->lang->line('general_word_qslcard_bureau').")"; + break; + case "D": + echo " (".$this->lang->line('general_word_qslcard_direct').")"; + break; + case "M": + echo " (".$this->lang->line('general_word_qslcard_via').": ".($qsl->COL_QSL_VIA!="" ? $qsl->COL_QSL_VIA:"n/a").")"; + break; + case "E": + echo " (".$this->lang->line('general_word_qslcard_electronic').")"; + break; + } + } + echo '">▲'; + echo 'COL_QSL_RCVD != "N") { + $timestamp = strtotime($qsl->COL_QSLRDATE); + switch ($qsl->COL_QSL_RCVD) { + case "Y": + echo "class=\"qsl-green\" data-toggle=\"tooltip\" data-original-title=\"".$this->lang->line('general_word_received')." ".date($custom_date_format,$timestamp); + break; + case "Q": + echo "class=\"qsl-yellow\" data-toggle=\"tooltip\" data-original-title=\"".$this->lang->line('general_word_queued')." ".date($custom_date_format,$timestamp); + break; + case "R": + echo "class=\"qsl-yellow\" data-toggle=\"tooltip\" data-original-title=\"".$this->lang->line('general_word_requested')." ".date($custom_date_format,$timestamp); + break; + case "I": + echo "class=\"qsl-grey\" data-toggle=\"tooltip\" data-original-title=\"".$this->lang->line('general_word_invalid_ignore')." ".date($custom_date_format,$timestamp); + break; + default: + echo "class=\"qsl-red"; + break; + } + } else { echo "class=\"qsl-red"; } + if ($qsl->COL_QSL_RCVD_VIA != "") { + switch ($qsl->COL_QSL_RCVD_VIA) { + case "B": + echo " (".$this->lang->line('general_word_qslcard_bureau').")"; + break; + case "D": + echo " (".$this->lang->line('general_word_qslcard_direct').")"; + break; + case "M": + echo " (Manager)"; + break; + case "E": + echo " (".$this->lang->line('general_word_qslcard_electronic').")"; + break; + } + } + echo '">▼'; + + if ($this->session->userdata('user_eqsl_name') != ""){ + echo ''; + echo 'COL_EQSL_QSL_SENT == "Y") { + $timestamp = strtotime($qsl->COL_EQSL_QSLSDATE); + echo "data-original-title=\"".$this->lang->line('eqsl_short')." ".$this->lang->line('general_word_sent')." ".($timestamp!=''?date($custom_date_format, $timestamp):'')."\" data-toggle=\"tooltip\""; + } + echo ' class="eqsl-'; + echo ($qsl->COL_EQSL_QSL_SENT=='Y')?'green':'red'; + echo '">▲'; + + echo 'COL_EQSL_QSL_RCVD == "Y") { + $timestamp = strtotime($qsl->COL_EQSL_QSLRDATE); + echo "data-original-title=\"".$this->lang->line('eqsl_short')." ".$this->lang->line('general_word_received')." ".($timestamp!=''?date($custom_date_format, $timestamp):'')."\" data-toggle=\"tooltip\""; + } + echo ' class="eqsl-'; + echo ($qsl->COL_EQSL_QSL_RCVD=='Y')?'green':'red'; + echo '">▼'; + echo ''; + echo 'COL_LOTW_QSL_SENT == "Y") { + $timestamp = strtotime($qsl->COL_LOTW_QSLSDATE); + echo "data-original-title=\"".$this->lang->line('lotw_short')." ".$this->lang->line('general_word_sent')." ".($timestamp!=''?date($custom_date_format, $timestamp):'')."\" data-toggle=\"tooltip\""; + } + echo ' class="lotw-'; + echo ($qsl->COL_LOTW_QSL_SENT=='Y')?'green':'red'; + echo '">▲'; + + echo 'COL_LOTW_QSL_RCVD == "Y") { + $timestamp = strtotime($qsl->COL_LOTW_QSLRDATE); + echo "data-original-title=\"".$this->lang->line('lotw_short')." ".$this->lang->line('general_word_received')." ".($timestamp!=''?date($custom_date_format, $timestamp):'')."\" data-toggle=\"tooltip\""; + } + echo ' class="lotw-'; + echo ($qsl->COL_LOTW_QSL_RCVD=='Y')?'green':'red'; + echo '">▼'; + echo '
'; + ?> + + ×No QSO\'s were found. It seems you were not active at this time.'; +} +?> From 5db5f7387e19da9f5612274e7b0a67fe13df1b95 Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Wed, 14 Dec 2022 12:38:17 +0100 Subject: [PATCH 3/5] [OQRS] Updated migration script number --- application/migrations/{106_add_oqrs.php => 110_add_oqrs.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename application/migrations/{106_add_oqrs.php => 110_add_oqrs.php} (100%) diff --git a/application/migrations/106_add_oqrs.php b/application/migrations/110_add_oqrs.php similarity index 100% rename from application/migrations/106_add_oqrs.php rename to application/migrations/110_add_oqrs.php From 2ba3d146834416e123e7af1f6c6e69ca612e4d55 Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Wed, 21 Dec 2022 22:13:08 +0100 Subject: [PATCH 4/5] [OQRS] Updated migration script number again --- application/migrations/{110_add_oqrs.php => 112_add_oqrs.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename application/migrations/{110_add_oqrs.php => 112_add_oqrs.php} (100%) diff --git a/application/migrations/110_add_oqrs.php b/application/migrations/112_add_oqrs.php similarity index 100% rename from application/migrations/110_add_oqrs.php rename to application/migrations/112_add_oqrs.php From 880c87238d3af5dfcf1571d766968460d166ec5b Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Wed, 21 Dec 2022 22:29:04 +0100 Subject: [PATCH 5/5] [OQRS] Removed default on text column --- application/migrations/112_add_oqrs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/migrations/112_add_oqrs.php b/application/migrations/112_add_oqrs.php index c1d78182..e0691651 100644 --- a/application/migrations/112_add_oqrs.php +++ b/application/migrations/112_add_oqrs.php @@ -16,7 +16,7 @@ class Migration_add_oqrs extends CI_Migration { if (!$this->db->field_exists('oqrs_text', 'station_profile')) { $fields = array( - 'oqrs_text text DEFAULT ""', + 'oqrs_text text', ); $this->dbforge->add_column('station_profile', $fields);