这个提交包含在:
int2001 2023-07-04 18:49:00 +00:00
父节点 ee90929a3c
当前提交 ca850adf22
共有 6 个文件被更改,包括 65 次插入29 次删除

查看文件

@ -15,6 +15,7 @@ class eqsl extends CI_Controller {
$folder_name = "images/eqsl_card_images"; $folder_name = "images/eqsl_card_images";
$data['storage_used'] = $this->sizeFormat($this->folderSize($folder_name)); $data['storage_used'] = $this->sizeFormat($this->folderSize($folder_name));
// Render Page // Render Page
$data['page_title'] = "eQSL Cards"; $data['page_title'] = "eQSL Cards";
@ -29,6 +30,12 @@ class eqsl extends CI_Controller {
$this->load->model('user_model'); $this->load->model('user_model');
if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
$this->load->model('stations');
$data['station_profile'] = $this->stations->all_of_user();
$active_station_id = $this->stations->find_active();
$station_profile = $this->stations->profile($active_station_id);
$data['active_station_info'] = $station_profile->row();
// Check if eQSL Nicknames have been defined // Check if eQSL Nicknames have been defined
$this->load->model('eqslmethods_model'); $this->load->model('eqslmethods_model');
$eqsl_locations = $this->eqslmethods_model->all_of_user_with_eqsl_nick_defined(); $eqsl_locations = $this->eqslmethods_model->all_of_user_with_eqsl_nick_defined();
@ -71,29 +78,39 @@ class eqsl extends CI_Controller {
$eqsl_results[] = $this->eqslimporter->fetch($eqsl_password); $eqsl_results[] = $this->eqslimporter->fetch($eqsl_password);
} }
} } elseif ($this->input->post('eqslimport') == 'upload') {
else $station_id4upload=$this->input->post('station_profile');
{ if ($this->stations->check_station_is_accessible($station_id4upload)) {
if ( ! $this->upload->do_upload()) $station_callsign=$this->stations->profile($station_id4upload)->row()->station_callsign;
{ if ( ! $this->upload->do_upload())
$data['page_title'] = "eQSL Import"; {
$data['error'] = $this->upload->display_errors(); $data['page_title'] = "eQSL Import";
$data['error'] = $this->upload->display_errors();
$this->load->view('interface_assets/header', $data); $this->load->view('interface_assets/header', $data);
$this->load->view('eqsl/import'); $this->load->view('eqsl/import');
$this->load->view('interface_assets/footer'); $this->load->view('interface_assets/footer');
return; return;
} else {
$data = array('upload_data' => $this->upload->data());
$this->load->library('EqslImporter');
$this->eqslimporter->from_file('./uploads/'.$data['upload_data']['file_name'],$station_callsign);
$eqsl_results[] = $this->eqslimporter->import();
}
} else {
log_message('error',$station_id4upload." is not valid for user!");
} }
else } else {
{ $data['page_title'] = "eQSL Import";
$data = array('upload_data' => $this->upload->data());
$this->load->library('EqslImporter'); $this->load->view('interface_assets/header', $data);
$this->eqslimporter->from_file('./uploads/'.$data['upload_data']['file_name']); $this->load->view('eqsl/import');
$this->load->view('interface_assets/footer');
$eqsl_results[] = $this->eqslimporter->import(); return;
}
} }
$data['eqsl_results'] = $eqsl_results; $data['eqsl_results'] = $eqsl_results;

查看文件

@ -497,7 +497,7 @@ class Lotw extends CI_Controller {
$record['qsl_rcvd'] = $config['lotw_rcvd_mark']; $record['qsl_rcvd'] = $config['lotw_rcvd_mark'];
} }
$status = $this->logbook_model->import_check($time_on, $record['call'], $record['band']); $status = $this->logbook_model->import_check($time_on, $record['call'], $record['band'],$record['station_callsign']);
$skipNewQso = $this->input->post('importMissing'); // If import missing was checked $skipNewQso = $this->input->post('importMissing'); // If import missing was checked
if($status[0] == "No Match" && $skipNewQso != NULL) { if($status[0] == "No Match" && $skipNewQso != NULL) {
@ -550,7 +550,12 @@ class Lotw extends CI_Controller {
$ituz = ""; $ituz = "";
} }
$lotw_status = $this->logbook_model->lotw_update($time_on, $record['call'], $record['band'], $qsl_date, $record['qsl_rcvd'], $state, $qsl_gridsquare, $iota, $cnty, $cqz, $ituz); $station_id = $this->logbook_model->find_correct_station_id($record['station_callsign'], $record['my_gridsquare']);
if ($station_id != NULL) {
$lotw_status = $this->logbook_model->lotw_update($time_on, $record['call'], $record['band'], $qsl_date, $record['qsl_rcvd'], $state, $qsl_gridsquare, $iota, $cnty, $cqz, $ituz, $station_id);
} else {
$lotw_status = "No matching Grid/OP-Call (check Locations)";
}
} }

查看文件

@ -36,8 +36,9 @@ class EqslImporter
$this->qth_nickname = $qth; $this->qth_nickname = $qth;
} }
public function from_file($adif_file) { public function from_file($adif_file,$station_callsign) {
$this->init('ADIF upload', $adif_file); $this->init('ADIF upload', $adif_file);
$this->callsign=$station_callsign;
} }
// generate a sanitized file name from a callsign and a QTH nickname // generate a sanitized file name from a callsign and a QTH nickname
@ -136,6 +137,7 @@ class EqslImporter
$query = $this->CI->db->query('SELECT eqsl_rcvd_mark FROM config'); $query = $this->CI->db->query('SELECT eqsl_rcvd_mark FROM config');
$q = $query->row(); $q = $query->row();
$config['eqsl_rcvd_mark'] = $q->eqsl_rcvd_mark; $config['eqsl_rcvd_mark'] = $q->eqsl_rcvd_mark;
$station_callsign=$this->callsign;
$this->CI->adif_parser->load_from_file($this->adif_file); $this->CI->adif_parser->load_from_file($this->adif_file);
$this->CI->adif_parser->initialize(); $this->CI->adif_parser->initialize();
@ -154,14 +156,14 @@ class EqslImporter
$record['qsl_sent'] = $config['eqsl_rcvd_mark']; $record['qsl_sent'] = $config['eqsl_rcvd_mark'];
} }
$status = $this->CI->logbook_model->import_check($time_on, $record['call'], $record['band']); $status = $this->CI->logbook_model->import_check($time_on, $record['call'], $record['band'],$station_callsign);
$qsoid = 0; $qsoid = 0;
if ($status[0] == "Found") { if ($status[0] == "Found") {
$qsoid = $status[1]; $qsoid = $status[1];
$dupe = $this->CI->eqslmethods_model->eqsl_dupe_check($time_on, $record['call'], $record['band'], $config['eqsl_rcvd_mark']); $dupe = $this->CI->eqslmethods_model->eqsl_dupe_check($time_on, $record['call'], $record['band'], $config['eqsl_rcvd_mark'],$station_callsign);
if ($dupe == false) { if ($dupe == false) {
$updated += 1; $updated += 1;
$eqsl_status = $this->CI->eqslmethods_model->eqsl_update($time_on, $record['call'], $record['band'], $config['eqsl_rcvd_mark']); $eqsl_status = $this->CI->eqslmethods_model->eqsl_update($time_on, $record['call'], $record['band'], $config['eqsl_rcvd_mark'],$station_callsign);
} else { } else {
$dupes += 1; $dupes += 1;
$eqsl_status = "Already received an eQSL for this QSO."; $eqsl_status = "Already received an eQSL for this QSO.";

查看文件

@ -156,7 +156,7 @@ class Eqslmethods_model extends CI_Model {
// Update a QSO with eQSL QSL info // Update a QSO with eQSL QSL info
// We could also probably use this use this: http://eqsl.cc/qslcard/VerifyQSO.txt // We could also probably use this use this: http://eqsl.cc/qslcard/VerifyQSO.txt
// http://www.eqsl.cc/qslcard/ImportADIF.txt // http://www.eqsl.cc/qslcard/ImportADIF.txt
function eqsl_update($datetime, $callsign, $band, $qsl_status) { function eqsl_update($datetime, $callsign, $band, $qsl_status,$station_callsign) {
$data = array( $data = array(
'COL_EQSL_QSLRDATE' => date('Y-m-d H:i:s'), // eQSL doesn't give us a date, so let's use current 'COL_EQSL_QSLRDATE' => date('Y-m-d H:i:s'), // eQSL doesn't give us a date, so let's use current
'COL_EQSL_QSL_RCVD' => $qsl_status 'COL_EQSL_QSL_RCVD' => $qsl_status
@ -165,6 +165,7 @@ class Eqslmethods_model extends CI_Model {
$this->db->where('COL_TIME_ON >= DATE_ADD(DATE_FORMAT("'.$datetime.'", \'%Y-%m-%d %H:%i\' ), INTERVAL -15 MINUTE )'); $this->db->where('COL_TIME_ON >= DATE_ADD(DATE_FORMAT("'.$datetime.'", \'%Y-%m-%d %H:%i\' ), INTERVAL -15 MINUTE )');
$this->db->where('COL_TIME_ON <= DATE_ADD(DATE_FORMAT("'.$datetime.'", \'%Y-%m-%d %H:%i\' ), INTERVAL 15 MINUTE )'); $this->db->where('COL_TIME_ON <= DATE_ADD(DATE_FORMAT("'.$datetime.'", \'%Y-%m-%d %H:%i\' ), INTERVAL 15 MINUTE )');
$this->db->where('COL_CALL', $callsign); $this->db->where('COL_CALL', $callsign);
$this->db->where('COL_STATION_CALLSIGN', $station_callsign);
$this->db->where('COL_BAND', $band); $this->db->where('COL_BAND', $band);
$this->db->update($this->config->item('table_name'), $data); $this->db->update($this->config->item('table_name'), $data);
@ -173,12 +174,13 @@ class Eqslmethods_model extends CI_Model {
} }
// Determine if we've already received an eQSL for this QSO // Determine if we've already received an eQSL for this QSO
function eqsl_dupe_check($datetime, $callsign, $band, $qsl_status) { function eqsl_dupe_check($datetime, $callsign, $band, $qsl_status,$station_callsign) {
$this->db->select('COL_EQSL_QSLRDATE'); $this->db->select('COL_EQSL_QSLRDATE');
$this->db->where('COL_TIME_ON >= DATE_ADD(DATE_FORMAT("'.$datetime.'", \'%Y-%m-%d %H:%i\' ), INTERVAL -15 MINUTE )'); $this->db->where('COL_TIME_ON >= DATE_ADD(DATE_FORMAT("'.$datetime.'", \'%Y-%m-%d %H:%i\' ), INTERVAL -15 MINUTE )');
$this->db->where('COL_TIME_ON <= DATE_ADD(DATE_FORMAT("'.$datetime.'", \'%Y-%m-%d %H:%i\' ), INTERVAL 15 MINUTE )'); $this->db->where('COL_TIME_ON <= DATE_ADD(DATE_FORMAT("'.$datetime.'", \'%Y-%m-%d %H:%i\' ), INTERVAL 15 MINUTE )');
$this->db->where('COL_CALL', $callsign); $this->db->where('COL_CALL', $callsign);
$this->db->where('COL_BAND', $band); $this->db->where('COL_BAND', $band);
$this->db->where('COL_STATION_CALLSIGN', $station_callsign);
$this->db->where('COL_EQSL_QSL_RCVD', $qsl_status); $this->db->where('COL_EQSL_QSL_RCVD', $qsl_status);
$this->db->limit(1); $this->db->limit(1);

查看文件

@ -2469,12 +2469,13 @@ class Logbook_model extends CI_Model {
} }
/* Used to check if the qso is already in the database */ /* Used to check if the qso is already in the database */
function import_check($datetime, $callsign, $band) { function import_check($datetime, $callsign, $band,$station_callsign) {
$this->db->select('COL_PRIMARY_KEY, COL_TIME_ON, COL_CALL, COL_BAND'); $this->db->select('COL_PRIMARY_KEY, COL_TIME_ON, COL_CALL, COL_BAND');
$this->db->where('COL_TIME_ON >= DATE_ADD(DATE_FORMAT("'.$datetime.'", \'%Y-%m-%d %H:%i\' ), INTERVAL -15 MINUTE )'); $this->db->where('COL_TIME_ON >= DATE_ADD(DATE_FORMAT("'.$datetime.'", \'%Y-%m-%d %H:%i\' ), INTERVAL -15 MINUTE )');
$this->db->where('COL_TIME_ON <= DATE_ADD(DATE_FORMAT("'.$datetime.'", \'%Y-%m-%d %H:%i\' ), INTERVAL 15 MINUTE )'); $this->db->where('COL_TIME_ON <= DATE_ADD(DATE_FORMAT("'.$datetime.'", \'%Y-%m-%d %H:%i\' ), INTERVAL 15 MINUTE )');
$this->db->where('COL_CALL', $callsign); $this->db->where('COL_CALL', $callsign);
$this->db->where('COL_STATION_CALLSIGN', $station_callsign);
$this->db->where('COL_BAND', $band); $this->db->where('COL_BAND', $band);
$query = $this->db->get($this->config->item('table_name')); $query = $this->db->get($this->config->item('table_name'));
@ -2488,7 +2489,7 @@ class Logbook_model extends CI_Model {
} }
} }
function lotw_update($datetime, $callsign, $band, $qsl_date, $qsl_status, $state, $qsl_gridsquare, $iota, $cnty, $cqz, $ituz) { function lotw_update($datetime, $callsign, $band, $qsl_date, $qsl_status, $state, $qsl_gridsquare, $iota, $cnty, $cqz, $ituz, $station_id) {
$data = array( $data = array(
'COL_LOTW_QSLRDATE' => $qsl_date, 'COL_LOTW_QSLRDATE' => $qsl_date,
@ -2517,6 +2518,7 @@ class Logbook_model extends CI_Model {
$this->db->where('date_format(COL_TIME_ON, \'%Y-%m-%d %H:%i\') = "'.$datetime.'"'); $this->db->where('date_format(COL_TIME_ON, \'%Y-%m-%d %H:%i\') = "'.$datetime.'"');
$this->db->where('COL_CALL', $callsign); $this->db->where('COL_CALL', $callsign);
$this->db->where('COL_BAND', $band); $this->db->where('COL_BAND', $band);
$this->db->where('station_id', $station_id);
$this->db->update($this->config->item('table_name'), $data); $this->db->update($this->config->item('table_name'), $data);
unset($data); unset($data);

查看文件

@ -29,10 +29,18 @@
<label class="form-check-label" for="exampleRadios1"> <label class="form-check-label" for="exampleRadios1">
Import from file... Import from file...
</label> </label>
<br><br> <br><br>
<p>Upload the Exported ADIF file from eQSL from the <a href="http://eqsl.cc/qslcard/DownloadInBox.cfm" target="_blank">Download Inbox</a> page, to mark QSOs as confirmed on eQSL.</p> <p>Upload the Exported ADIF file from eQSL from the <a href="http://eqsl.cc/qslcard/DownloadInBox.cfm" target="_blank">Download Inbox</a> page, to mark QSOs as confirmed on eQSL.</p>
<p><span class="label important">Important</span> Log files must have the file type .adi</p> <p><span class="label important">Important</span> Log files must have the file type .adi</p>
<input type="file" name="userfile" size="20" /> <input type="file" name="userfile" size="20" />
<br/><br/>
<p>Choose Station(location) eQSL File belongs to:</p>
<select name="station_profile" class="custom-select mb-2 mr-sm-2" style="width: 20%;">
<option value="0">Select Station Location</option>
<?php foreach ($station_profile->result() as $station) { ?>
<option value="<?php echo $station->station_id; ?>" <?php if ($station->station_id == $this->stations->find_active()) { echo " selected =\"selected\""; } ?>>Callsign: <?php echo $station->station_callsign; ?> (<?php echo $station->station_profile_name.") eQSL: ".$station->eqslqthnickname; ?></option>
<?php } ?>
</select>
</div> </div>
<br><br> <br><br>