diff --git a/application/controllers/Qso.php b/application/controllers/Qso.php index 4ed585656..78dacb44e 100644 --- a/application/controllers/Qso.php +++ b/application/controllers/Qso.php @@ -304,11 +304,14 @@ class QSO extends CI_Controller { $this->form_validation->set_rules('time_off', 'End Date', 'required'); $this->form_validation->set_rules('id', 'qso ID', 'required'); + $edit_result=array(); $edit_result['success']=false; if ($this->form_validation->run()) { $edit_result=$this->logbook_model->edit(); + } else { + $edit_result['success']=false; } - header('Content-Type: application/json; charset=utf-8'); + header('Content-Type: application/json'); echo json_encode($edit_result); } diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index afaece8a9..47543176b 100644 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -1198,6 +1198,8 @@ class Logbook_model extends CI_Model { /* Edit QSO */ function edit() { + $retvals=[]; + $retvals['success']=false; $qso = $this->get_qso($this->input->post('id'))->row(); $entity = $this->get_entity($this->input->post('dxcc_id')); @@ -1207,11 +1209,13 @@ class Logbook_model extends CI_Model { // be sure that station belongs to user $this->load->model('stations'); if (!$this->stations->check_station_is_accessible($stationId)) { - return; + $retvals['detail']='Station ID not allowed'; + return $retvals; } if (trim($this->input->post('callsign')) == '') { - return; + $retvals['detail']='No Call given'; + return $retvals; } $station_profile = $this->stations->profile_clean($stationId); @@ -1528,7 +1532,6 @@ class Logbook_model extends CI_Model { } $this->db->where('COL_PRIMARY_KEY', $this->input->post('id')); - $retvals=[]; try { $this->db->update($this->config->item('table_name'), $data); $retvals['success']=true; diff --git a/assets/js/sections/common.js b/assets/js/sections/common.js index e89df6a92..f79eba4e8 100644 --- a/assets/js/sections/common.js +++ b/assets/js/sections/common.js @@ -541,11 +541,13 @@ function qso_save() { contentType: false, type: 'POST', success: function (dataofconfirm) { - $(".edit-dialog").modal('hide'); - $(".qso-dialog").modal('hide'); - if (reload_after_qso_safe == true) { - location.reload(); - } + if (dataofconfirm.success) { + $(".edit-dialog").modal('hide'); + $(".qso-dialog").modal('hide'); + if (reload_after_qso_safe == true) { + location.reload(); + } + } }, error: function(xhr, status, error) { console.log(xhr.responseText);