Prevent mysql error if no date is given at edit

This commit is contained in:
int2001
2025-02-13 14:44:12 +00:00
parent 8ab16a9b58
commit 1a52776f3e
2 changed files with 20 additions and 8 deletions

View File

@@ -294,13 +294,18 @@ class QSO extends CI_Controller {
}
function qso_save_ajax() {
$this->load->model('logbook_model');
$this->load->model('user_model');
if(!$this->user_model->authorize(2)) {
$this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard');
}
$this->load->library('form_validation');
$this->load->model('logbook_model');
$this->load->model('user_model');
if(!$this->user_model->authorize(2)) {
$this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard');
}
$this->form_validation->set_rules('time_on', 'Start Date', 'required');
$this->form_validation->set_rules('time_off', 'End Date', 'required');
$this->logbook_model->edit();
if ($this->form_validation->run()) {
$this->logbook_model->edit();
}
}
function qsl_rcvd($id, $method) {

View File

@@ -1424,9 +1424,16 @@ class Logbook_model extends CI_Model {
$distance = null;
}
$time_on=$this->input->post('time_on');
$time_off=$this->input->post('time_off');
if (($time_off ?? '') == '') {
$time_off=$time_on;
}
$data = array(
'COL_TIME_ON' => $this->input->post('time_on'),
'COL_TIME_OFF' => $this->input->post('time_off'),
'COL_TIME_ON' => $time_on,
'COL_TIME_OFF' => $time_off,
'COL_CALL' => strtoupper(trim($this->input->post('callsign'))),
'COL_BAND' => $this->input->post('band'),
'COL_BAND_RX' => $this->input->post('band_rx'),