Merge pull request #1111 from T012m3n7oR/master
Add the gridsquare from LotW QSL to the logbook
这个提交包含在:
当前提交
a2da3753ed
共有 2 个文件被更改,包括 46 次插入 和 16 次删除
|
|
@ -466,6 +466,7 @@ class Lotw extends CI_Controller {
|
|||
$tableheaders .= "<td>LoTW QSL Received</td>";
|
||||
$tableheaders .= "<td>Date LoTW Confirmed</td>";
|
||||
$tableheaders .= "<td>State</td>";
|
||||
$tableheaders .= "<td>Gridsquare</td>";
|
||||
$tableheaders .= "<td>Log Status</td>";
|
||||
$tableheaders .= "<td>LoTW Status</td>";
|
||||
$tableheaders .= "</tr>";
|
||||
|
|
@ -512,8 +513,15 @@ class Lotw extends CI_Controller {
|
|||
} else {
|
||||
$state = "";
|
||||
}
|
||||
// Present only if the QSLing station specified a single valid grid square value in its station location uploaded to LoTW.
|
||||
if (isset($record['gridsquare'])) {
|
||||
$qsl_gridsquare = $record['gridsquare'];
|
||||
} else {
|
||||
$qsl_gridsquare = "";
|
||||
}
|
||||
|
||||
$lotw_status = $this->logbook_model->lotw_update($time_on, $record['call'], $record['band'], $qsl_date, $record['qsl_rcvd'], $state);
|
||||
|
||||
$lotw_status = $this->logbook_model->lotw_update($time_on, $record['call'], $record['band'], $qsl_date, $record['qsl_rcvd'], $state, $qsl_gridsquare);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -525,6 +533,7 @@ class Lotw extends CI_Controller {
|
|||
$table .= "<td>".$record['qsl_rcvd']."</td>";
|
||||
$table .= "<td>".$qsl_date."</td>";
|
||||
$table .= "<td>".$state."</td>";
|
||||
$table .= "<td>".$qsl_gridsquare."</td>";
|
||||
$table .= "<td>QSO Record: ".$status."</td>";
|
||||
$table .= "<td>LoTW Record: ".$lotw_status."</td>";
|
||||
$table .= "</tr>";
|
||||
|
|
|
|||
|
|
@ -1477,28 +1477,49 @@ class Logbook_model extends CI_Model {
|
|||
}
|
||||
}
|
||||
|
||||
function lotw_update($datetime, $callsign, $band, $qsl_date, $qsl_status, $state) {
|
||||
function lotw_update($datetime, $callsign, $band, $qsl_date, $qsl_status, $state, $qsl_gridsquare) {
|
||||
|
||||
if($state != "") {
|
||||
$data = array(
|
||||
'COL_LOTW_QSLRDATE' => $qsl_date,
|
||||
'COL_LOTW_QSL_RCVD' => $qsl_status,
|
||||
'COL_LOTW_QSL_SENT' => 'Y',
|
||||
'COL_STATE' => $state
|
||||
);
|
||||
} else {
|
||||
$data = array(
|
||||
'COL_LOTW_QSLRDATE' => $qsl_date,
|
||||
'COL_LOTW_QSL_RCVD' => $qsl_status,
|
||||
'COL_LOTW_QSL_SENT' => 'Y'
|
||||
);
|
||||
}
|
||||
$data = array(
|
||||
'COL_LOTW_QSLRDATE' => $qsl_date,
|
||||
'COL_LOTW_QSL_RCVD' => $qsl_status,
|
||||
'COL_LOTW_QSL_SENT' => 'Y'
|
||||
);
|
||||
if($state != "") {
|
||||
$data['COL_STATE'] = $state;
|
||||
}
|
||||
|
||||
$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->update($this->config->item('table_name'), $data);
|
||||
unset($data);
|
||||
|
||||
if($qsl_gridsquare != "") {
|
||||
$data = array(
|
||||
'COL_GRIDSQUARE' => $qsl_gridsquare
|
||||
);
|
||||
$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->group_start();
|
||||
$this->db->where('COL_VUCC_GRIDS');
|
||||
$this->db->or_where('COL_VUCC_GRIDS', '');
|
||||
$this->db->group_end();
|
||||
if(strlen($qsl_gridsquare) > 4) {
|
||||
$this->db->group_start();
|
||||
$this->db->where('COL_GRIDSQUARE', "");
|
||||
$this->db->or_where('COL_GRIDSQUARE', substr($qsl_gridsquare, 0, 4));
|
||||
if(strlen($qsl_gridsquare) > 6) {
|
||||
$this->db->or_where('COL_GRIDSQUARE', substr($qsl_gridsquare, 0, 6));
|
||||
}
|
||||
$this->db->group_end();
|
||||
} else {
|
||||
$this->db->where('COL_GRIDSQUARE', "");
|
||||
}
|
||||
|
||||
$this->db->update($this->config->item('table_name'), $data);
|
||||
}
|
||||
|
||||
return "Updated";
|
||||
}
|
||||
|
|
|
|||
正在加载…
在新工单中引用