[Advanced Logbook] Received QSL (direct/bureau) can be set
这个提交包含在:
父节点
cf05c9017d
当前提交
aa139017d9
共有 3 个文件被更改,包括 80 次插入 和 0 次删除
|
|
@ -184,4 +184,32 @@ class Logbookadvanced extends CI_Controller {
|
|||
header("Content-Type: application/json");
|
||||
print json_encode($q);
|
||||
}
|
||||
|
||||
function update_qsl_received() {
|
||||
$this->load->model('logbookadvanced_model');
|
||||
|
||||
$ids = xss_clean($this->input->post('id'));
|
||||
$user_id = (int)$this->session->userdata('user_id');
|
||||
$method = xss_clean($this->input->post('method'));
|
||||
$sent = xss_clean($this->input->post('sent'));
|
||||
|
||||
$status = $this->logbookadvanced_model->updateQslReceived($ids, $user_id, $method, $sent);
|
||||
|
||||
$data = $this->logbookadvanced_model->getQsosForAdif($ids, $user_id);
|
||||
|
||||
$results = $data->result('array');
|
||||
|
||||
$qsos = [];
|
||||
foreach ($results as $data) {
|
||||
$qsos[] = new QSO($data);
|
||||
}
|
||||
|
||||
$q = [];
|
||||
foreach ($qsos as $qso) {
|
||||
$q[] = $qso->toArray();
|
||||
}
|
||||
|
||||
header("Content-Type: application/json");
|
||||
print json_encode($q);
|
||||
}
|
||||
}
|
||||
|
|
@ -136,6 +136,7 @@ class Logbookadvanced_model extends CI_Model {
|
|||
FROM " . $this->config->item('table_name') . " qsos
|
||||
INNER JOIN station_profile ON qsos.station_id = station_profile.station_id
|
||||
LEFT OUTER JOIN dxcc_entities ON qsos.COL_MY_DXCC = dxcc_entities.adif
|
||||
LEFT OUTER JOIN lotw_users ON qsos.col_call=lotw_users.callsign
|
||||
WHERE station_profile.user_id = ?
|
||||
$where
|
||||
$order
|
||||
|
|
@ -215,6 +216,24 @@ class Logbookadvanced_model extends CI_Model {
|
|||
}
|
||||
}
|
||||
|
||||
public function updateQslReceived($ids, $user_id, $method, $sent) {
|
||||
$this->load->model('user_model');
|
||||
|
||||
if(!$this->user_model->authorize(2)) {
|
||||
return array('message' => 'Error');
|
||||
} else {
|
||||
$data = array(
|
||||
'COL_QSLRDATE' => date('Y-m-d H:i:s'),
|
||||
'COL_QSL_RCVD' => $sent,
|
||||
'COL_QSL_RCVD_VIA' => $method
|
||||
);
|
||||
$this->db->where_in('COL_PRIMARY_KEY', json_decode($ids, true));
|
||||
$this->db->update($this->config->item('table_name'), $data);
|
||||
|
||||
return array('message' => 'OK');
|
||||
}
|
||||
}
|
||||
|
||||
public function updateQsoWithCallbookInfo($qsoID, $qso, $callbook) {
|
||||
$updatedData = array();
|
||||
if (!empty($callbook['name']) && empty($qso['COL_NAME'])) {
|
||||
|
|
|
|||
|
|
@ -349,8 +349,10 @@ $(document).ready(function () {
|
|||
handleQsl('I','', 'notRequired');
|
||||
});
|
||||
$('#receivedBureau').click(function (event) {
|
||||
handleQslReceived('Y','B', 'receivedBureau');
|
||||
});
|
||||
$('#receivedDirect').click(function (event) {
|
||||
handleQslReceived('Y','D', 'receivedDirect');
|
||||
});
|
||||
|
||||
$('#printLabel').click(function (event) {
|
||||
|
|
@ -428,6 +430,37 @@ $(document).ready(function () {
|
|||
});
|
||||
}
|
||||
|
||||
function handleQslReceived(sent, method, tag) {
|
||||
var elements = $('#qsoList tbody input:checked');
|
||||
var nElements = elements.length;
|
||||
if (nElements == 0) {
|
||||
return;
|
||||
}
|
||||
$('#'+tag).prop("disabled", true);
|
||||
var id_list=[];
|
||||
elements.each(function() {
|
||||
let id = $(this).first().closest('tr').data('qsoID')
|
||||
id_list.push(id);
|
||||
});
|
||||
$.ajax({
|
||||
url: base_url + 'index.php/logbookadvanced/update_qsl_received',
|
||||
type: 'post',
|
||||
data: {'id': JSON.stringify(id_list, null, 2),
|
||||
'sent' : sent,
|
||||
'method' : method
|
||||
},
|
||||
success: function(data) {
|
||||
if (data !== []) {
|
||||
$.each(data, function(k, v) {
|
||||
updateRow(this);
|
||||
unselectQsoID(this.qsoID);
|
||||
});
|
||||
}
|
||||
$('#'+tag).prop("disabled", false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('#checkBoxAll').change(function (event) {
|
||||
if (this.checked) {
|
||||
$('#qsoList tbody tr').each(function (i) {
|
||||
|
|
|
|||
正在加载…
在新工单中引用