[eQSL] Errors if no eQSL Nicknames have been defined with Station Profiles (Fixes #613)

这个提交包含在:
Peter Goodhall 2020-09-15 22:49:05 +01:00
父节点 75a4870ad9
当前提交 9ce97d1236
共有 2 个文件被更改,包括 33 次插入2 次删除

查看文件

@ -94,6 +94,13 @@ class eqsl extends CI_Controller {
}
public function import() {
$this->load->model('stations');
if($this->stations->are_eqsl_nicks_defined() == 0) {
show_error('eQSL Nicknames in Station Profiles arent defined');
exit;
}
ini_set('memory_limit', '-1');
set_time_limit(0);
@ -249,6 +256,11 @@ class eqsl extends CI_Controller {
} // end function
public function export() {
if($this->stations->are_eqsl_nicks_defined() == 0) {
show_error('eQSL Nicknames in Station Profiles arent defined');
exit;
}
ini_set('memory_limit', '-1');
set_time_limit(0);
$this->load->model('logbook_model');

查看文件

@ -30,8 +30,12 @@ class Stations extends CI_Model {
return $this->db->get('station_profile');
}
/*
* Function: add
* Adds post material into the station profile table.
*/
function add() {
// Create data array with field values
$data = array(
'station_profile_name' => xss_clean($this->input->post('station_profile_name', true)),
'station_gridsquare' => xss_clean(strtoupper($this->input->post('gridsquare', true))),
@ -49,6 +53,7 @@ class Stations extends CI_Model {
'qrzapikey' => xss_clean($this->input->post('qrzapikey', true)),
);
// Insert Records
$this->db->insert('station_profile', $data);
}
@ -218,6 +223,20 @@ class Stations extends CI_Model {
return $query;
}
/*
* Function: are_eqsl_nicks_defined
* Description: Returns number of station profiles with eqslnicknames
*/
function are_eqsl_nicks_defined() {
$this->db->select('eqslqthnickname');
$this->db->where('eqslqthnickname IS NOT NULL');
$this->db->where('eqslqthnickname !=', '');
$this->db->from('station_profile');
$query = $this->db->get();
return $query->num_rows();
}
}
?>