Update ADIF import prodecure to find country and dxcc

这个提交包含在:
Andy 2016-02-28 17:43:45 +00:00
父节点 35363f2374
当前提交 6bd219f1f2

查看文件

@ -762,25 +762,30 @@ class Logbook_model extends CI_Model {
$gridsquare = ""; $gridsquare = "";
} }
// DXCC id
$dxcc = $this->check_dxcc_table($record['call'], $time_off);
// Store or find country name // Store or find country name
if(isset($record['country'])) { if(isset($record['country'])) {
$country = $record['country']; $country = $record['country'];
} else { } else {
$this->load->model('dxcc'); // $this->load->model('dxcc');
$dxccinfo = $this->dxcc->info($record['call']); // $dxccinfo = $this->dxcc->info($record['call']);
if ($dxccinfo->num_rows() > 0) // if ($dxccinfo->num_rows() > 0)
{ // {
foreach ($dxccinfo->result() as $row1) // foreach ($dxccinfo->result() as $row1)
{ // {
$country = ucfirst(strtolower($row1->name)); // $country = ucfirst(strtolower($row1->name));
} // }
} else { // } else {
$country = ""; // $country = "";
} // }
$country = ucwords(strtolower($dxcc[1]));
} }
// Store QTH // Store QTH
if(isset($record['qth'])) { if(isset($record['qth'])) {
$qth = $record['qth']; $qth = $record['qth'];
@ -889,7 +894,6 @@ class Logbook_model extends CI_Model {
$mode = $record['mode']; $mode = $record['mode'];
} }
$this->db->where('COL_CALL', $record['call']); $this->db->where('COL_CALL', $record['call']);
$this->db->where('COL_TIME_ON', $time_on); $this->db->where('COL_TIME_ON', $time_on);
$check = $this->db->get($this->config->item('table_name')); $check = $this->db->get($this->config->item('table_name'));
@ -927,7 +931,8 @@ class Logbook_model extends CI_Model {
'COL_QSLSDATE' => $QSLSDATE, 'COL_QSLSDATE' => $QSLSDATE,
'COL_QSL_SENT' => $QSLSENT, 'COL_QSL_SENT' => $QSLSENT,
'COL_LOTW_QSL_SENT' => $LOTWQSLSENT, 'COL_LOTW_QSL_SENT' => $LOTWQSLSENT,
'COL_LOTW_QSL_RCVD' => $LOTWQSLRCVD 'COL_LOTW_QSL_RCVD' => $LOTWQSLRCVD,
'COL_DXCC' => $dxcc[0],
); );
// if eQSL username set, default SENT & RCVD to 'N' else leave as null // if eQSL username set, default SENT & RCVD to 'N' else leave as null
@ -941,6 +946,9 @@ class Logbook_model extends CI_Model {
} }
/*
* Check the dxxc_prefixes table and return (dxcc, country)
*/
private function check_dxcc_table($call, $date){ private function check_dxcc_table($call, $date){
$len = strlen($call); $len = strlen($call);