Use DXCC ID from LotW certificate (rather than selecting DXCC manually)
这个提交包含在:
父节点
dcc2bb6aee
当前提交
19c72eb75a
共有 6 个文件被更改,包括 49 次插入 和 22 次删除
|
|
@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE;
|
||||||
| be upgraded / downgraded to.
|
| be upgraded / downgraded to.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
$config['migration_version'] = 117;
|
$config['migration_version'] = 118;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -153,20 +153,20 @@ class Lotw extends CI_Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check to see if certificate is already in the system
|
// Check to see if certificate is already in the system
|
||||||
$new_certificate = $this->LotwCert->find_cert($info['issued_callsign'], $dxcc, $this->session->userdata('user_id'));
|
$new_certificate = $this->LotwCert->find_cert($info['issued_callsign'], $info['dxcc-id'], $this->session->userdata('user_id'));
|
||||||
|
|
||||||
if($new_certificate == 0) {
|
if($new_certificate == 0) {
|
||||||
// New Certificate Store in Database
|
// New Certificate Store in Database
|
||||||
|
|
||||||
// Store Certificate Data into MySQL
|
// Store Certificate Data into MySQL
|
||||||
$this->LotwCert->store_certificate($this->session->userdata('user_id'), $info['issued_callsign'], $dxcc, $info['validFrom'], $info['validTo_Date'], $info['qso-first-date'], $info['qso-end-date'], $info['pem_key'], $info['general_cert']);
|
$this->LotwCert->store_certificate($this->session->userdata('user_id'), $info['issued_callsign'], $info['dxcc-id'], $info['validFrom'], $info['validTo_Date'], $info['qso-first-date'], $info['qso-end-date'], $info['pem_key'], $info['general_cert']);
|
||||||
|
|
||||||
// Cert success flash message
|
// Cert success flash message
|
||||||
$this->session->set_flashdata('Success', $info['issued_callsign'].' Certificate Imported.');
|
$this->session->set_flashdata('Success', $info['issued_callsign'].' Certificate Imported.');
|
||||||
} else {
|
} else {
|
||||||
// Certificate is in the system time to update
|
// Certificate is in the system time to update
|
||||||
|
|
||||||
$this->LotwCert->update_certificate($this->session->userdata('user_id'), $info['issued_callsign'], $dxcc, $info['validFrom'], $info['validTo_Date'], $info['pem_key'], $info['general_cert']);
|
$this->LotwCert->update_certificate($this->session->userdata('user_id'), $info['issued_callsign'], $info['dxcc-id'], $info['validFrom'], $info['validTo_Date'], $info['pem_key'], $info['general_cert']);
|
||||||
|
|
||||||
// Cert success flash message
|
// Cert success flash message
|
||||||
$this->session->set_flashdata('Success', $info['issued_callsign'].' Certificate Updated.');
|
$this->session->set_flashdata('Success', $info['issued_callsign'].' Certificate Updated.');
|
||||||
|
|
@ -443,6 +443,7 @@ class Lotw extends CI_Controller {
|
||||||
// https://oidref.com/1.3.6.1.4.1.12348.1
|
// https://oidref.com/1.3.6.1.4.1.12348.1
|
||||||
$data['qso-first-date'] = $certdata['extensions']['1.3.6.1.4.1.12348.1.2'];
|
$data['qso-first-date'] = $certdata['extensions']['1.3.6.1.4.1.12348.1.2'];
|
||||||
$data['qso-end-date'] = $certdata['extensions']['1.3.6.1.4.1.12348.1.3'];
|
$data['qso-end-date'] = $certdata['extensions']['1.3.6.1.4.1.12348.1.3'];
|
||||||
|
$data['dxcc-id'] = $certdata['extensions']['1.3.6.1.4.1.12348.1.4'];
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?php
|
||||||
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Migration_make_lotw_use_dxcc_id extends CI_Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$fields = array(
|
||||||
|
'cert_dxcc_id SMALLINT(6) NOT NULL AFTER `cert_dxcc`',
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!$this->db->field_exists('cert_dxcc_id', 'lotw_certs')) {
|
||||||
|
$this->dbforge->add_column('lotw_certs', $fields);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = 'UPDATE `lotw_certs` JOIN `dxcc_entities` ON `lotw_certs`.`cert_dxcc` = `dxcc_entities`.`name` SET `lotw_certs`.`cert_dxcc_id` = `dxcc_entities`.`adif`;';
|
||||||
|
$this->db->query($sql);
|
||||||
|
|
||||||
|
$this->dbforge->drop_column('lotw_certs', 'cert_dxcc');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
$fields = array(
|
||||||
|
'cert_dxcc VARCHAR(255) NOT NULL AFTER `callsign`',
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!$this->db->field_exists('cert_dxcc', 'lotw_certs')) {
|
||||||
|
$this->dbforge->add_column('lotw_certs', $fields);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = 'UPDATE `lotw_certs` JOIN `dxcc_entities` ON `lotw_certs`.`cert_dxcc_id` = `dxcc_entities`.`adif` SET `lotw_certs`.`cert_dxcc` = `dxcc_entities`.`name`;';
|
||||||
|
$this->db->query($sql);
|
||||||
|
|
||||||
|
$this->dbforge->drop_column('lotw_certs', 'cert_dxcc_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -12,7 +12,9 @@ class LotwCert extends CI_Model {
|
||||||
*/
|
*/
|
||||||
function lotw_certs($user_id) {
|
function lotw_certs($user_id) {
|
||||||
|
|
||||||
|
$this->db->select('lotw_certs.lotw_cert_id as lotw_cert_id, lotw_certs.callsign as callsign, dxcc_entities.name as cert_dxcc, lotw_certs.qso_start_date as qso_start_date, lotw_certs.qso_end_date as qso_end_date, lotw_certs.date_created as date_created, lotw_certs.date_expires as date_expires, lotw_certs.last_upload as last_upload');
|
||||||
$this->db->where('user_id', $user_id);
|
$this->db->where('user_id', $user_id);
|
||||||
|
$this->db->join('dxcc_entities','lotw_certs.cert_dxcc_id = dxcc_entities.adif','left');
|
||||||
$this->db->order_by('cert_dxcc', 'ASC');
|
$this->db->order_by('cert_dxcc', 'ASC');
|
||||||
$query = $this->db->get('lotw_certs');
|
$query = $this->db->get('lotw_certs');
|
||||||
|
|
||||||
|
|
@ -29,7 +31,7 @@ class LotwCert extends CI_Model {
|
||||||
|
|
||||||
function find_cert($callsign, $dxcc, $user_id) {
|
function find_cert($callsign, $dxcc, $user_id) {
|
||||||
$this->db->where('user_id', $user_id);
|
$this->db->where('user_id', $user_id);
|
||||||
$this->db->where('cert_dxcc', $dxcc);
|
$this->db->where('cert_dxcc_id', $dxcc);
|
||||||
$this->db->where('callsign', $callsign);
|
$this->db->where('callsign', $callsign);
|
||||||
$query = $this->db->get('lotw_certs');
|
$query = $this->db->get('lotw_certs');
|
||||||
|
|
||||||
|
|
@ -40,7 +42,7 @@ class LotwCert extends CI_Model {
|
||||||
$data = array(
|
$data = array(
|
||||||
'user_id' => $user_id,
|
'user_id' => $user_id,
|
||||||
'callsign' => $callsign,
|
'callsign' => $callsign,
|
||||||
'cert_dxcc' => $dxcc,
|
'cert_dxcc_id' => $dxcc,
|
||||||
'date_created' => $date_created,
|
'date_created' => $date_created,
|
||||||
'date_expires' => $date_expires,
|
'date_expires' => $date_expires,
|
||||||
'qso_start_date' => $qso_start_date,
|
'qso_start_date' => $qso_start_date,
|
||||||
|
|
@ -54,7 +56,7 @@ class LotwCert extends CI_Model {
|
||||||
|
|
||||||
function update_certificate($user_id, $callsign, $dxcc, $date_created, $date_expires, $cert_key, $general_cert) {
|
function update_certificate($user_id, $callsign, $dxcc, $date_created, $date_expires, $cert_key, $general_cert) {
|
||||||
$data = array(
|
$data = array(
|
||||||
'cert_dxcc' => $dxcc,
|
'cert_dxcc_id' => $dxcc,
|
||||||
'date_created' => $date_created,
|
'date_created' => $date_created,
|
||||||
'date_expires' => $date_expires,
|
'date_expires' => $date_expires,
|
||||||
'cert_key' => $cert_key,
|
'cert_key' => $cert_key,
|
||||||
|
|
@ -63,7 +65,7 @@ class LotwCert extends CI_Model {
|
||||||
|
|
||||||
$this->db->where('user_id', $user_id);
|
$this->db->where('user_id', $user_id);
|
||||||
$this->db->where('callsign', $callsign);
|
$this->db->where('callsign', $callsign);
|
||||||
$this->db->where('cert_dxcc', $dxcc);
|
$this->db->where('cert_dxcc_id', $dxcc);
|
||||||
$this->db->update('lotw_certs', $data);
|
$this->db->update('lotw_certs', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@
|
||||||
<?php foreach ($lotw_cert_results->result() as $row) { ?>
|
<?php foreach ($lotw_cert_results->result() as $row) { ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo $row->callsign; ?></td>
|
<td><?php echo $row->callsign; ?></td>
|
||||||
<td><?php echo ucfirst($row->cert_dxcc); ?></td>
|
<td><?php echo $row->cert_dxcc == '' ? '- NONE -' : ucfirst($row->cert_dxcc); ?></td>
|
||||||
<td><?php
|
<td><?php
|
||||||
if (isset($row->qso_start_date)) {
|
if (isset($row->qso_start_date)) {
|
||||||
$valid_qso_start = strtotime( $row->qso_start_date );
|
$valid_qso_start = strtotime( $row->qso_start_date );
|
||||||
|
|
|
||||||
|
|
@ -32,19 +32,6 @@
|
||||||
<input type="file" name="userfile" class="form-control-file" id="exampleFormControlFile1">
|
<input type="file" name="userfile" class="form-control-file" id="exampleFormControlFile1">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="stationDXCCInput"><?php echo $this->lang->line('lotw_certificate_dxcc'); ?></label>
|
|
||||||
<?php if ($dxcc_list->num_rows() > 0) { ?>
|
|
||||||
<select class="form-control" id="dxcc_select" name="dxcc" aria-describedby="stationCallsignInputHelp">
|
|
||||||
<option value=""></option>
|
|
||||||
<?php foreach ($dxcc_list->result() as $dxcc) { ?>
|
|
||||||
<option value="<?php echo $dxcc->name; ?>"><?php echo $dxcc->name; ?></option>
|
|
||||||
<?php } ?>
|
|
||||||
</select>
|
|
||||||
<?php } ?>
|
|
||||||
<small id="stationDXCCInputHelp" class="form-text text-muted"><?php echo $this->lang->line('lotw_certificate_dxcc_help_text'); ?></small>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<button type="submit" value="upload" class="btn btn-primary"><?php echo $this->lang->line('lotw_btn_upload_file'); ?></button>
|
<button type="submit" value="upload" class="btn btn-primary"><?php echo $this->lang->line('lotw_btn_upload_file'); ?></button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
|
||||||
正在加载…
在新工单中引用