Fixed #2238
这个提交包含在:
父节点
ee90929a3c
当前提交
ca850adf22
共有 6 个文件被更改,包括 65 次插入 和 29 次删除
|
|
@ -15,6 +15,7 @@ class eqsl extends CI_Controller {
|
|||
$folder_name = "images/eqsl_card_images";
|
||||
$data['storage_used'] = $this->sizeFormat($this->folderSize($folder_name));
|
||||
|
||||
|
||||
// Render Page
|
||||
$data['page_title'] = "eQSL Cards";
|
||||
|
||||
|
|
@ -29,6 +30,12 @@ class eqsl extends CI_Controller {
|
|||
$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'); }
|
||||
|
||||
$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
|
||||
$this->load->model('eqslmethods_model');
|
||||
$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);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ! $this->upload->do_upload())
|
||||
{
|
||||
$data['page_title'] = "eQSL Import";
|
||||
$data['error'] = $this->upload->display_errors();
|
||||
} elseif ($this->input->post('eqslimport') == 'upload') {
|
||||
$station_id4upload=$this->input->post('station_profile');
|
||||
if ($this->stations->check_station_is_accessible($station_id4upload)) {
|
||||
$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();
|
||||
|
||||
$this->load->view('interface_assets/header', $data);
|
||||
$this->load->view('eqsl/import');
|
||||
$this->load->view('interface_assets/footer');
|
||||
$this->load->view('interface_assets/header', $data);
|
||||
$this->load->view('eqsl/import');
|
||||
$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
|
||||
{
|
||||
$data = array('upload_data' => $this->upload->data());
|
||||
} else {
|
||||
$data['page_title'] = "eQSL Import";
|
||||
|
||||
$this->load->library('EqslImporter');
|
||||
$this->eqslimporter->from_file('./uploads/'.$data['upload_data']['file_name']);
|
||||
$this->load->view('interface_assets/header', $data);
|
||||
$this->load->view('eqsl/import');
|
||||
$this->load->view('interface_assets/footer');
|
||||
|
||||
$eqsl_results[] = $this->eqslimporter->import();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
$data['eqsl_results'] = $eqsl_results;
|
||||
|
|
|
|||
|
|
@ -497,7 +497,7 @@ class Lotw extends CI_Controller {
|
|||
$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
|
||||
|
||||
if($status[0] == "No Match" && $skipNewQso != NULL) {
|
||||
|
|
@ -550,7 +550,12 @@ class Lotw extends CI_Controller {
|
|||
$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;
|
||||
}
|
||||
|
||||
public function from_file($adif_file) {
|
||||
public function from_file($adif_file,$station_callsign) {
|
||||
$this->init('ADIF upload', $adif_file);
|
||||
$this->callsign=$station_callsign;
|
||||
}
|
||||
|
||||
// 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');
|
||||
$q = $query->row();
|
||||
$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->initialize();
|
||||
|
|
@ -154,14 +156,14 @@ class EqslImporter
|
|||
$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;
|
||||
if ($status[0] == "Found") {
|
||||
$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) {
|
||||
$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 {
|
||||
$dupes += 1;
|
||||
$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
|
||||
// We could also probably use this use this: http://eqsl.cc/qslcard/VerifyQSO.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(
|
||||
'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
|
||||
|
|
@ -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_CALL', $callsign);
|
||||
$this->db->where('COL_STATION_CALLSIGN', $station_callsign);
|
||||
$this->db->where('COL_BAND', $band);
|
||||
|
||||
$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
|
||||
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->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_BAND', $band);
|
||||
$this->db->where('COL_STATION_CALLSIGN', $station_callsign);
|
||||
$this->db->where('COL_EQSL_QSL_RCVD', $qsl_status);
|
||||
$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 */
|
||||
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->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_STATION_CALLSIGN', $station_callsign);
|
||||
$this->db->where('COL_BAND', $band);
|
||||
|
||||
$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(
|
||||
'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('COL_CALL', $callsign);
|
||||
$this->db->where('COL_BAND', $band);
|
||||
$this->db->where('station_id', $station_id);
|
||||
|
||||
$this->db->update($this->config->item('table_name'), $data);
|
||||
unset($data);
|
||||
|
|
|
|||
|
|
@ -29,10 +29,18 @@
|
|||
<label class="form-check-label" for="exampleRadios1">
|
||||
Import from file...
|
||||
</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><span class="label important">Important</span> Log files must have the file type .adi</p>
|
||||
<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>
|
||||
|
||||
<br><br>
|
||||
|
|
|
|||
正在加载…
在新工单中引用