Merge pull request #2079 from phl0/removeRedundantDxccData
这个提交包含在:
当前提交
3ab60c4109
共有 11 个文件被更改,包括 75 次插入 和 22 次删除
|
|
@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE;
|
|||
| be upgraded / downgraded to.
|
||||
|
|
||||
*/
|
||||
$config['migration_version'] = 118;
|
||||
$config['migration_version'] = 119;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Migration_remove_dxcc_name_from_station_profile extends CI_Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
if ($this->db->field_exists('station_country', 'station_profile')) {
|
||||
$this->dbforge->drop_column('station_profile', 'station_country');
|
||||
}
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$fields = array(
|
||||
'station_country VARCHAR(255) NULL DEFAULT NULL AFTER `station_dxcc`',
|
||||
);
|
||||
|
||||
if (!$this->db->field_exists('station_country', 'station_profile')) {
|
||||
$this->dbforge->add_column('station_profile', $fields);
|
||||
}
|
||||
|
||||
$sql = 'UPDATE `station_profile` JOIN `dxcc_entities` ON `station_profile`.`station_dxcc` = `dxcc_entities`.`adif` SET `station_profile`.`station_country` = `dxcc_entities`.`name`;';
|
||||
$this->db->query($sql);
|
||||
}
|
||||
}
|
||||
|
|
@ -5,9 +5,11 @@ class adif_data extends CI_Model {
|
|||
function export_all() {
|
||||
$this->load->model('stations');
|
||||
$active_station_id = $this->stations->find_active();
|
||||
$this->db->select($this->config->item('table_name').'.*, station_profile.*, dxcc_entities.name as station_country');
|
||||
$this->db->where($this->config->item('table_name').'.station_id', $active_station_id);
|
||||
$this->db->order_by("COL_TIME_ON", "ASC");
|
||||
$this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
|
||||
$this->db->join('dxcc_entities', 'station_profile.station_dxcc = dxcc_entities.adif');
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
return $query;
|
||||
|
|
@ -17,6 +19,8 @@ class adif_data extends CI_Model {
|
|||
$this->load->model('stations');
|
||||
$active_station_id = $this->stations->find_active();
|
||||
|
||||
$this->db->select($this->config->item('table_name').'.*, station_profile.*, dxcc_entities.name as station_country');
|
||||
|
||||
if ($station_id == NULL) {
|
||||
$this->db->where($this->config->item('table_name').'.station_id', $active_station_id);
|
||||
} else if ($station_id != 'All') {
|
||||
|
|
@ -24,6 +28,7 @@ class adif_data extends CI_Model {
|
|||
}
|
||||
|
||||
$this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
|
||||
$this->db->join('dxcc_entities', 'station_profile.station_dxcc = dxcc_entities.adif');
|
||||
// always filter user. this ensures that even if the station_id is from another user no inaccesible QSOs will be returned
|
||||
$this->db->where('station_profile.user_id', $this->session->userdata('user_id'));
|
||||
$this->db->where_in('COL_QSL_SENT', array('R', 'Q'));
|
||||
|
|
@ -37,7 +42,7 @@ class adif_data extends CI_Model {
|
|||
$this->load->model('stations');
|
||||
$active_station_id = $this->stations->find_active();
|
||||
|
||||
$this->db->select(''.$this->config->item('table_name').'.*, station_profile.*');
|
||||
$this->db->select(''.$this->config->item('table_name').'.*, station_profile.*, dxcc_entities.name as station_country');
|
||||
$this->db->from($this->config->item('table_name'));
|
||||
$this->db->where($this->config->item('table_name').'.station_id', $active_station_id);
|
||||
$this->db->where($this->config->item('table_name').'.COL_PROP_MODE', 'SAT');
|
||||
|
|
@ -45,6 +50,7 @@ class adif_data extends CI_Model {
|
|||
$this->db->order_by($this->config->item('table_name').".COL_TIME_ON", "ASC");
|
||||
|
||||
$this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
|
||||
$this->db->join('dxcc_entities', 'station_profile.station_dxcc = dxcc_entities.adif');
|
||||
|
||||
return $this->db->get();
|
||||
}
|
||||
|
|
@ -53,7 +59,7 @@ class adif_data extends CI_Model {
|
|||
$this->load->model('stations');
|
||||
$active_station_id = $this->stations->find_active();
|
||||
|
||||
$this->db->select(''.$this->config->item('table_name').'.*, station_profile.*');
|
||||
$this->db->select(''.$this->config->item('table_name').'.*, station_profile.*, dxcc_entities.name as station_country');
|
||||
$this->db->from($this->config->item('table_name'));
|
||||
$this->db->where($this->config->item('table_name').'.station_id', $active_station_id);
|
||||
$this->db->where($this->config->item('table_name').'.COL_PROP_MODE', 'SAT');
|
||||
|
|
@ -65,6 +71,7 @@ class adif_data extends CI_Model {
|
|||
|
||||
|
||||
$this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
|
||||
$this->db->join('dxcc_entities', 'station_profile.station_dxcc = dxcc_entities.adif');
|
||||
|
||||
return $this->db->get();
|
||||
}
|
||||
|
|
@ -77,7 +84,7 @@ class adif_data extends CI_Model {
|
|||
return;
|
||||
}
|
||||
|
||||
$this->db->select(''.$this->config->item('table_name').'.*, station_profile.*');
|
||||
$this->db->select(''.$this->config->item('table_name').'.*, station_profile.*, dxcc_entities.name as station_country');
|
||||
$this->db->from($this->config->item('table_name'));
|
||||
$this->db->where($this->config->item('table_name').'.station_id', $station_id);
|
||||
|
||||
|
|
@ -102,6 +109,7 @@ class adif_data extends CI_Model {
|
|||
$this->db->order_by($this->config->item('table_name').".COL_TIME_ON", "ASC");
|
||||
|
||||
$this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
|
||||
$this->db->join('dxcc_entities', 'station_profile.station_dxcc = dxcc_entities.adif');
|
||||
|
||||
return $this->db->get();
|
||||
}
|
||||
|
|
@ -111,7 +119,7 @@ class adif_data extends CI_Model {
|
|||
$active_station_id = $this->stations->find_active();
|
||||
|
||||
|
||||
$this->db->select(''.$this->config->item('table_name').'.*, station_profile.*');
|
||||
$this->db->select(''.$this->config->item('table_name').'.*, station_profile.*, dxcc_entities.name as station_country');
|
||||
$this->db->from($this->config->item('table_name'));
|
||||
$this->db->where($this->config->item('table_name').'.station_id', $active_station_id);
|
||||
$this->db->group_start();
|
||||
|
|
@ -122,6 +130,7 @@ class adif_data extends CI_Model {
|
|||
$this->db->order_by($this->config->item('table_name').".COL_TIME_ON", "ASC");
|
||||
|
||||
$this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
|
||||
$this->db->join('dxcc_entities', 'station_profile.station_dxcc = dxcc_entities.adif');
|
||||
|
||||
return $this->db->get();
|
||||
}
|
||||
|
|
@ -141,7 +150,7 @@ class adif_data extends CI_Model {
|
|||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
$this->db->select(''.$this->config->item('table_name').'.*, station_profile.*');
|
||||
$this->db->select(''.$this->config->item('table_name').'.*, station_profile.*, dxcc_entities.name as station_country');
|
||||
$this->db->from($this->config->item('table_name'));
|
||||
$this->db->where_in($this->config->item('table_name').'.station_id', $logbooks_locations_array);
|
||||
$this->db->where($this->config->item('table_name').'.COL_SIG', $type);
|
||||
|
|
@ -149,6 +158,7 @@ class adif_data extends CI_Model {
|
|||
$this->db->order_by($this->config->item('table_name').".COL_TIME_ON", "ASC");
|
||||
|
||||
$this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
|
||||
$this->db->join('dxcc_entities', 'station_profile.station_dxcc = dxcc_entities.adif');
|
||||
|
||||
return $this->db->get();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,9 @@ class Clublog_model extends CI_Model {
|
|||
}
|
||||
|
||||
function get_clublog_qsos($station_id){
|
||||
$this->db->select('*, dxcc_entities.name as station_country');
|
||||
$this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
|
||||
$this->db->join('dxcc_entities', 'station_profile.station_dxcc = dxcc_entities.adif', 'left');
|
||||
$this->db->where($this->config->item('table_name').'.station_id', $station_id);
|
||||
$this->db->group_start();
|
||||
$this->db->where("COL_CLUBLOG_QSO_UPLOAD_STATUS", null);
|
||||
|
|
@ -92,4 +94,4 @@ class Clublog_model extends CI_Model {
|
|||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -294,6 +294,8 @@ class Logbook_model extends CI_Model {
|
|||
|
||||
public function check_station($id){
|
||||
|
||||
$this->db->select('station_profile.*, dxcc_entities.name as station_country');
|
||||
$this->db->join('dxcc_entities','station_profile.station_dxcc = dxcc_entities.adif','left');
|
||||
$this->db->where('station_id', $id);
|
||||
$query = $this->db->get('station_profile');
|
||||
|
||||
|
|
@ -1287,9 +1289,11 @@ class Logbook_model extends CI_Model {
|
|||
}
|
||||
|
||||
function get_qso($id) {
|
||||
$this->db->select($this->config->item('table_name').'.*, station_profile.*, dxcc_entities.*, dxcc_entities_2.name as station_country');
|
||||
$this->db->from($this->config->item('table_name'));
|
||||
$this->db->join('dxcc_entities', $this->config->item('table_name').'.col_dxcc = dxcc_entities.adif', 'left');
|
||||
$this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
|
||||
$this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id', 'left');
|
||||
$this->db->join('dxcc_entities as dxcc_entities_2', 'station_profile.station_dxcc = dxcc_entities_2.adif');
|
||||
$this->db->where('COL_PRIMARY_KEY', $id);
|
||||
|
||||
return $this->db->get();
|
||||
|
|
@ -1299,8 +1303,9 @@ class Logbook_model extends CI_Model {
|
|||
* Function returns the QSOs from the logbook, which have not been either marked as uploaded to qrz, or has been modified with an edit
|
||||
*/
|
||||
function get_qrz_qsos($station_id){
|
||||
$sql = 'select * from ' . $this->config->item('table_name') . ' thcv ' .
|
||||
' join station_profile on thcv.station_id = station_profile.station_id' .
|
||||
$sql = 'select *, dxcc_entities.name as station_country from ' . $this->config->item('table_name') . ' thcv ' .
|
||||
' left join station_profile on thcv.station_id = station_profile.station_id' .
|
||||
' left join dxcc_entities on thcv.col_my_dxcc = dxcc_entities.adif' .
|
||||
' where thcv.station_id = ' . $station_id .
|
||||
' and (COL_QRZCOM_QSO_UPLOAD_STATUS is NULL
|
||||
or COL_QRZCOM_QSO_UPLOAD_STATUS = ""
|
||||
|
|
@ -1316,9 +1321,10 @@ class Logbook_model extends CI_Model {
|
|||
*/
|
||||
function get_webadif_qsos($station_id,$from = null, $to = null){
|
||||
$sql = "
|
||||
SELECT qsos.*, station_profile.*
|
||||
SELECT qsos.*, station_profile.*, dxcc_entities.name as station_country
|
||||
FROM %s qsos
|
||||
INNER JOIN station_profile ON qsos.station_id = station_profile.station_id
|
||||
LEFT JOIN dxcc_entities on qsos.col_my_dxcc = dxcc_entities.adif
|
||||
LEFT JOIN webadif ON qsos.COL_PRIMARY_KEY = webadif.qso_id
|
||||
WHERE qsos.station_id = %d
|
||||
AND qsos.COL_SAT_NAME = 'QO-100'
|
||||
|
|
@ -3121,8 +3127,10 @@ class Logbook_model extends CI_Model {
|
|||
|
||||
// Collect field information from the station profile table thats required for the QSO.
|
||||
if($station_id != "0") {
|
||||
$station_result = $this->db->where('station_id', $station_id)
|
||||
->get('station_profile');
|
||||
$this->db->select('station_profile.*, dxcc_entities.name as station_country');
|
||||
$this->db->where('station_id', $station_id);
|
||||
$this->db->join('dxcc_entities', 'station_profile.station_dxcc = dxcc_entities.adif');
|
||||
$station_result = $this->db->get('station_profile');
|
||||
|
||||
if ($station_result->num_rows() > 0){
|
||||
$data['station_id'] = $station_id;
|
||||
|
|
|
|||
|
|
@ -118,9 +118,10 @@ class Logbookadvanced_model extends CI_Model {
|
|||
}
|
||||
|
||||
$sql = "
|
||||
SELECT *
|
||||
SELECT *, dxcc_entities.name AS station_country
|
||||
FROM " . $this->config->item('table_name') . " qsos
|
||||
INNER JOIN station_profile ON qsos.station_id = station_profile.station_id
|
||||
INNER JOIN dxcc_entities ON qsos.COL_MY_DXCC = dxcc_entities.adif
|
||||
WHERE station_profile.user_id = ?
|
||||
$where
|
||||
ORDER BY qsos.COL_TIME_ON desc
|
||||
|
|
|
|||
|
|
@ -262,7 +262,9 @@ class Logbooks_model extends CI_Model {
|
|||
array_push($relationships_array, $row->station_location_id);
|
||||
}
|
||||
|
||||
$this->db->select('station_profile.*, dxcc_entities.name as station_country');
|
||||
$this->db->where_in('station_id', $relationships_array);
|
||||
$this->db->join('dxcc_entities','station_profile.station_dxcc = dxcc_entities.adif','left');
|
||||
$query = $this->db->get('station_profile');
|
||||
|
||||
return $query;
|
||||
|
|
|
|||
|
|
@ -4,9 +4,10 @@ class Stations extends CI_Model {
|
|||
|
||||
function all_with_count() {
|
||||
|
||||
$this->db->select('station_profile.*, count('.$this->config->item('table_name').'.station_id) as qso_total');
|
||||
$this->db->select('station_profile.*, dxcc_entities.name as station_country, count('.$this->config->item('table_name').'.station_id) as qso_total');
|
||||
$this->db->from('station_profile');
|
||||
$this->db->join($this->config->item('table_name'),'station_profile.station_id = '.$this->config->item('table_name').'.station_id','left');
|
||||
$this->db->join('dxcc_entities','station_profile.station_dxcc = dxcc_entities.adif','left');
|
||||
$this->db->group_by('station_profile.station_id');
|
||||
$this->db->where('station_profile.user_id', $this->session->userdata('user_id'));
|
||||
$this->db->or_where('station_profile.user_id =', NULL);
|
||||
|
|
@ -16,11 +17,16 @@ class Stations extends CI_Model {
|
|||
// Returns ALL station profiles regardless of user logged in
|
||||
// This is also used by LoTW sync so must not be changed.
|
||||
function all() {
|
||||
return $this->db->get('station_profile');
|
||||
$this->db->select('station_profile.*, dxcc_entities.name as station_country');
|
||||
$this->db->from('station_profile');
|
||||
$this->db->join('dxcc_entities','station_profile.station_dxcc = dxcc_entities.adif','left');
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
function all_of_user() {
|
||||
$this->db->select('station_profile.*, dxcc_entities.name as station_country');
|
||||
$this->db->where('user_id', $this->session->userdata('user_id'));
|
||||
$this->db->join('dxcc_entities','station_profile.station_dxcc = dxcc_entities.adif','left');
|
||||
return $this->db->get('station_profile');
|
||||
}
|
||||
|
||||
|
|
@ -70,7 +76,6 @@ class Stations extends CI_Model {
|
|||
'station_sig_info' => xss_clean(strtoupper($this->input->post('sig_info', true))),
|
||||
'station_callsign' => xss_clean($this->input->post('station_callsign', true)),
|
||||
'station_dxcc' => xss_clean($this->input->post('dxcc', true)),
|
||||
'station_country' => xss_clean($this->input->post('station_country', true)),
|
||||
'station_cnty' => xss_clean($this->input->post('station_cnty', true)),
|
||||
'station_cq' => xss_clean($this->input->post('station_cq', true)),
|
||||
'station_itu' => xss_clean($this->input->post('station_itu', true)),
|
||||
|
|
@ -103,7 +108,6 @@ class Stations extends CI_Model {
|
|||
'station_sig_info' => xss_clean($this->input->post('sig_info', true)),
|
||||
'station_callsign' => xss_clean($this->input->post('station_callsign', true)),
|
||||
'station_dxcc' => xss_clean($this->input->post('dxcc', true)),
|
||||
'station_country' => xss_clean($this->input->post('station_country', true)),
|
||||
'station_cnty' => xss_clean($this->input->post('station_cnty', true)),
|
||||
'station_cq' => xss_clean($this->input->post('station_cq', true)),
|
||||
'station_itu' => xss_clean($this->input->post('station_itu', true)),
|
||||
|
|
@ -256,7 +260,9 @@ class Stations extends CI_Model {
|
|||
// Clean ID
|
||||
$clean_id = $this->security->xss_clean($id);
|
||||
|
||||
$this->db->where('station_id', $clean_id);
|
||||
$this->db->select('station_profile.*, dxcc_entities.name as station_country');
|
||||
$this->db->where('station_id', $clean_id);
|
||||
$this->db->join('dxcc_entities', 'station_profile.station_dxcc = dxcc_entities.adif');
|
||||
$query = $this->db->get('station_profile');
|
||||
|
||||
$row = $query->row();
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@
|
|||
<?php } ?>
|
||||
</select>
|
||||
<?php } ?>
|
||||
<input type="hidden" id="country" name="station_country" value="" required />
|
||||
<small id="stationDXCCInputHelp" class="form-text text-muted">Station DXCC entity. For example: Scotland</small>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,6 @@
|
|||
<?php } ?>
|
||||
</select>
|
||||
<?php } ?>
|
||||
<input type="hidden" id="country" name="station_country" value="<?php if(set_value('station_country') != "") { echo set_value('station_country'); } else { echo $my_station_profile->station_country; } ?>" required />
|
||||
<small id="stationDXCCInputHelp" class="form-text text-muted">Station DXCC entity. For example: Scotland</small>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@
|
|||
<?php echo $row->station_profile_name;?><br>
|
||||
</td>
|
||||
<td><?php echo $row->station_callsign;?></td>
|
||||
<td><?php echo $row->station_country;?></td>
|
||||
<td><?php echo $row->station_country == '' ? '- NONE -' : $row->station_country;?></td>
|
||||
<td><?php echo $row->station_gridsquare;?></td>
|
||||
<td style="text-align: center" data-order="<?php echo $row->station_id;?>">
|
||||
<?php if($row->station_active != 1) { ?>
|
||||
|
|
|
|||
正在加载…
在新工单中引用