diff --git a/application/controllers/Lotw.php b/application/controllers/Lotw.php index 04e238ab..6d41f74a 100644 --- a/application/controllers/Lotw.php +++ b/application/controllers/Lotw.php @@ -68,8 +68,12 @@ class Lotw extends CI_Controller { */ public function cert_upload() { $this->load->model('user_model'); + $this->load->model('dxcc'); if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + // Load DXCC Countrys List + $data['dxcc_list'] = $this->dxcc->list(); + // Set Page Title $data['page_title'] = "Logbook of the World"; @@ -91,6 +95,7 @@ class Lotw extends CI_Controller { public function do_cert_upload() { $this->load->model('user_model'); + $this->load->model('dxcc'); if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } // Fire OpenSSL missing error if not found @@ -131,13 +136,18 @@ class Lotw extends CI_Controller { $info = $this->decrypt_key($data['upload_data']['full_path']); - // Check to see if certificate is already in the system - $new_certficiate = $this->LotwCert->find_cert($info['issued_callsign'], $this->session->userdata('user_id')); - // Check DXCC & Store Country Name - $this->load->model('Logbook_model'); - $dxcc_check = $this->Logbook_model->check_dxcc_table($info['issued_callsign'], $info['validFrom']); - $dxcc = $dxcc_check[1]; + $this->load->model('Logbook_model'); + + if($this->input->post('dxcc') != "") { + $dxcc = $this->input->post('dxcc'); + } else{ + $dxcc_check = $this->Logbook_model->check_dxcc_table($info['issued_callsign'], $info['validFrom']); + $dxcc = $dxcc_check[1]; + } + + // Check to see if certificate is already in the system + $new_certficiate = $this->LotwCert->find_cert($info['issued_callsign'], $dxcc, $this->session->userdata('user_id')); if($new_certficiate == 0) { // New Certificate Store in Database diff --git a/application/models/LotwCert.php b/application/models/LotwCert.php index ba5da91a..9a4af000 100644 --- a/application/models/LotwCert.php +++ b/application/models/LotwCert.php @@ -33,8 +33,9 @@ class LotwCert extends CI_Model { return $query->row(); } - function find_cert($callsign, $user_id) { + function find_cert($callsign, $dxcc, $user_id) { $this->db->where('user_id', $user_id); + $this->db->where('cert_dxcc', $dxcc); $this->db->where('callsign', $callsign); $query = $this->db->get('lotw_certs'); diff --git a/application/views/lotw_views/upload_cert.php b/application/views/lotw_views/upload_cert.php index 607e893a..24ac7ca2 100644 --- a/application/views/lotw_views/upload_cert.php +++ b/application/views/lotw_views/upload_cert.php @@ -32,6 +32,19 @@ +
+ + num_rows() > 0) { ?> + + + Certificate DXCC entity. For example: Scotland +
+