diff --git a/application/models/Qsl_model.php b/application/models/Qsl_model.php index 38f4b3264..a54230241 100644 --- a/application/models/Qsl_model.php +++ b/application/models/Qsl_model.php @@ -141,7 +141,7 @@ class Qsl_model extends CI_Model { return $this->db->insert_id(); } - // return path of qsl file : u=url / p=real path + // return path of qsl file : u=url / p=real path function get_imagePath($pathorurl='u', $user_id=null) { // test if new folder directory option is enabled @@ -178,4 +178,68 @@ class Qsl_model extends CI_Model { return 'assets/qslcard'; } } + + function getConfirmations($confirmationtype) { + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (!$logbooks_locations_array) { + return null; + } + + $location_list = "'".implode("','",$logbooks_locations_array)."'"; + + $bindings = []; + + $table = $this->config->item('table_name'); + $sql_parts = array(); + + if ($confirmationtype == 'qsl' || $confirmationtype == 'All') { + $sql_parts[] = " + SELECT col_call, col_time_on, col_mode, col_submode, col_band, col_sat_name, col_qslrdate AS rxdate, 'QSL' AS type + FROM $table + WHERE station_id IN ($location_list) AND col_qslrdate IS NOT NULL AND col_qsl_rcvd = 'Y' + "; + } + if ($confirmationtype == 'lotw' || $confirmationtype == 'All') { + $sql_parts[] = " + SELECT col_call, col_time_on, col_mode, col_submode, col_band, col_sat_name, col_lotw_qslrdate AS rxdate, 'LoTW' AS type + FROM $table + WHERE station_id IN ($location_list) AND col_lotw_qslrdate IS NOT NULL AND col_lotw_qsl_rcvd = 'Y' + "; + } + if ($confirmationtype == 'eqsl' || $confirmationtype == 'All') { + $sql_parts[] = " + SELECT col_call, col_time_on, col_mode, col_submode, col_band, col_sat_name, col_eqsl_qslrdate AS rxdate, 'eQSL' AS type + FROM $table + WHERE station_id IN ($location_list) AND col_eqsl_qslrdate IS NOT NULL AND col_eqsl_qslrdate != '' AND col_eqsl_qsl_rcvd = 'Y' + "; + } + if ($confirmationtype == 'qrz' || $confirmationtype == 'All') { + $sql_parts[] = " + SELECT col_call, col_time_on, col_mode, col_submode, col_band, col_sat_name, col_qrzcom_qso_download_date AS rxdate, 'QRZ.com' AS type + FROM $table + WHERE station_id IN ($location_list) AND col_qrzcom_qso_download_date IS NOT NULL AND col_qrzcom_qso_download_status = 'Y' + "; + } + if ($confirmationtype == 'clublog' || $confirmationtype == 'All') { + $sql_parts[] = " + SELECT col_call, col_time_on, col_mode, col_submode, col_band, col_sat_name, col_clublog_qso_download_date AS rxdate, 'Clublog' AS type + FROM $table + WHERE station_id IN ($location_list) AND col_clublog_qso_download_date IS NOT NULL AND col_clublog_qso_download_status = 'Y' + "; + } + + if (count($sql_parts) == 0) { + return array(); + } + + $sql = implode(" UNION ALL ", $sql_parts); + $sql .= " ORDER BY rxdate DESC"; + + $query = $this->db->query($sql, $bindings); + + return $query->result(); + } } + diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 39b13d3d3..3e1460227 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -2840,17 +2840,6 @@ function viewEqsl(picture, callsign) { }); } - function searchAdditionalQsos(filename) { - $.ajax({ - url: base_url + 'index.php/qsl/searchQsos', - type: 'post', - data: {'callsign': $('#callsign').val(), 'filename': filename}, - success: function(html) { - $('#searchresult').empty(); - $('#searchresult').append(html); - } - }); - } uri->segment(1) == "contesting" && ($this->uri->segment(2) != "add" && $this->uri->segment(2) != "edit")) { ?>