Add the gridsquare from LotW QSL to the logbook
The gridsquare from the QSL will now update the log if the gridsquare was not previously populated, or if the LotW gridsquare is more specific than what previously existed. Previously the gridsquare was not being used from the LotW QSL record. This will enable the map above the logbook to more accurately display where the QSL was with instead of default values. - Add 'qsl_gridsquare' to the logbook_model.php:lotw_update implementation. - Refactor code in lotw_update to remove duplicate code. - Add gridsquare into the LotW output table on what is imported.
这个提交包含在:
父节点
3cb79050b9
当前提交
614452b07e
共有 2 个文件被更改,包括 42 次插入 和 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>";
|
||||
|
|
|
|||
|
|
@ -1401,28 +1401,45 @@ 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);
|
||||
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";
|
||||
}
|
||||
|
|
|
|||
正在加载…
在新工单中引用