[QSL Print] Delete now works. Added a working station profile selector, which changes table and links when changed.
这个提交包含在:
父节点
b80aaf4458
当前提交
c0a2134f62
共有 7 个文件被更改,包括 184 次插入 和 72 次删除
|
|
@ -35,9 +35,15 @@ class QSLPrint extends CI_Controller {
|
|||
// Set memory limit to unlimited to allow heavy usage
|
||||
ini_set('memory_limit', '-1');
|
||||
|
||||
if ($this->uri->segment(3) == 'All') {
|
||||
$station_id = NULL;
|
||||
} else {
|
||||
$station_id = $this->security->xss_clean($this->uri->segment(3));
|
||||
}
|
||||
|
||||
$this->load->model('adif_data');
|
||||
|
||||
$data['qsos'] = $this->adif_data->export_printrequested();
|
||||
$data['qsos'] = $this->adif_data->export_printrequested($station_id);
|
||||
|
||||
$this->load->view('adif/data/exportall', $data);
|
||||
}
|
||||
|
|
@ -47,9 +53,15 @@ class QSLPrint extends CI_Controller {
|
|||
// Set memory limit to unlimited to allow heavy usage
|
||||
ini_set('memory_limit', '-1');
|
||||
|
||||
if ($this->uri->segment(3) == 'All') {
|
||||
$station_id = NULL;
|
||||
} else {
|
||||
$station_id = $this->security->xss_clean($this->uri->segment(3));
|
||||
}
|
||||
|
||||
$this->load->model('logbook_model');
|
||||
|
||||
$myData = $this->logbook_model->get_qsos_for_printing();
|
||||
$myData = $this->logbook_model->get_qsos_for_printing($station_id);
|
||||
|
||||
// file name
|
||||
$filename = 'qsl_export.csv';
|
||||
|
|
@ -102,24 +114,41 @@ class QSLPrint extends CI_Controller {
|
|||
}
|
||||
|
||||
function qsl_printed() {
|
||||
|
||||
if ($this->uri->segment(3) == 'All') {
|
||||
$station_id = NULL;
|
||||
} else {
|
||||
$station_id = $this->security->xss_clean($this->uri->segment(3));
|
||||
}
|
||||
|
||||
$this->load->model('qslprint_model');
|
||||
$this->load->model('user_model');
|
||||
if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
|
||||
|
||||
// Update Logbook to Mark Paper Card Received
|
||||
|
||||
$this->qslprint_model->mark_qsos_printed();
|
||||
$this->qslprint_model->mark_qsos_printed($station_id);
|
||||
|
||||
$this->session->set_flashdata('notice', 'QSOs are marked as sent via buro');
|
||||
|
||||
redirect('logbook');
|
||||
}
|
||||
|
||||
public function delete_from_qsl_queue($id) {
|
||||
public function delete_from_qsl_queue() {
|
||||
$id = $this->input->post('id');
|
||||
$this->load->model('qslprint_model');
|
||||
|
||||
$this->qslprint_model->delete_from_qsl_queue($this->security->xss_clean($id));
|
||||
}
|
||||
|
||||
public function get_qsos_for_print_ajax() {
|
||||
$station_id = $this->input->post('station_id');
|
||||
$this->load->model('qslprint_model');
|
||||
|
||||
$data['qsos'] = $this->qslprint_model->get_qsos_for_print_ajax($this->security->xss_clean($station_id));
|
||||
$data['station_id'] = $station_id;
|
||||
$this->load->view('qslprint/qslprint', $data);
|
||||
}
|
||||
}
|
||||
|
||||
/* End of file Qslprint.php */
|
||||
|
|
|
|||
|
|
@ -19,11 +19,16 @@ class adif_data extends CI_Model {
|
|||
return $query;
|
||||
}
|
||||
|
||||
function export_printrequested() {
|
||||
function export_printrequested($station_id = NULL) {
|
||||
$this->load->model('stations');
|
||||
$active_station_id = $this->stations->find_active();
|
||||
|
||||
$this->db->where($this->config->item('table_name').'.station_id', $active_station_id);
|
||||
if ($station_id == NULL) {
|
||||
$this->db->where($this->config->item('table_name').'.station_id', $active_station_id);
|
||||
} else {
|
||||
$this->db->where($this->config->item('table_name').'.station_id', $station_id);
|
||||
}
|
||||
|
||||
$this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
|
||||
$this->db->where_in('COL_QSL_SENT', array('R', 'Q'));
|
||||
$this->db->order_by("COL_TIME_ON", "ASC");
|
||||
|
|
|
|||
|
|
@ -755,37 +755,45 @@ class Logbook_model extends CI_Model {
|
|||
$this->db->update($this->config->item('table_name'), $data);
|
||||
}
|
||||
|
||||
function get_qsos_for_printing() {
|
||||
function get_qsos_for_printing($station_id2 = null) {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
|
||||
$query = $this->db->query('SELECT
|
||||
STATION_CALLSIGN,
|
||||
COL_PRIMARY_KEY,
|
||||
COL_CALL,
|
||||
COL_QSL_VIA,
|
||||
COL_TIME_ON,
|
||||
COL_MODE,
|
||||
COL_SUBMODE,
|
||||
COL_FREQ,
|
||||
UPPER(COL_BAND) as COL_BAND,
|
||||
COL_RST_SENT,
|
||||
COL_SAT_NAME,
|
||||
COL_SAT_MODE,
|
||||
COL_QSL_RCVD,
|
||||
COL_COMMENT,
|
||||
(CASE WHEN COL_QSL_VIA != \'\' THEN COL_QSL_VIA ELSE COL_CALL END) AS COL_ROUTING,
|
||||
ADIF,
|
||||
ENTITY
|
||||
FROM '.$this->config->item('table_name').', dxcc_prefixes, station_profile
|
||||
WHERE
|
||||
COL_QSL_SENT in (\'R\', \'Q\')
|
||||
and (CASE WHEN COL_QSL_VIA != \'\' THEN COL_QSL_VIA ELSE COL_CALL END) like CONCAT(dxcc_prefixes.call,\'%\')
|
||||
and (end is null or end > now())
|
||||
and '.$this->config->item('table_name').'.station_id = '.$station_id.'
|
||||
and '.$this->config->item('table_name').'.station_id = station_profile.station_id
|
||||
ORDER BY adif, col_routing');
|
||||
$sql = 'SELECT
|
||||
STATION_CALLSIGN,
|
||||
COL_PRIMARY_KEY,
|
||||
COL_CALL,
|
||||
COL_QSL_VIA,
|
||||
COL_TIME_ON,
|
||||
COL_MODE,
|
||||
COL_SUBMODE,
|
||||
COL_FREQ,
|
||||
UPPER(COL_BAND) as COL_BAND,
|
||||
COL_RST_SENT,
|
||||
COL_SAT_NAME,
|
||||
COL_SAT_MODE,
|
||||
COL_QSL_RCVD,
|
||||
COL_COMMENT,
|
||||
(CASE WHEN COL_QSL_VIA != \'\' THEN COL_QSL_VIA ELSE COL_CALL END) AS COL_ROUTING,
|
||||
ADIF,
|
||||
ENTITY
|
||||
FROM '.$this->config->item('table_name').', dxcc_prefixes, station_profile
|
||||
WHERE
|
||||
COL_QSL_SENT in (\'R\', \'Q\')
|
||||
and (CASE WHEN COL_QSL_VIA != \'\' THEN COL_QSL_VIA ELSE COL_CALL END) like CONCAT(dxcc_prefixes.call,\'%\')
|
||||
and (end is null or end > now())
|
||||
and ' . $this->config->item('table_name') . '.station_id = station_profile.station_id';
|
||||
|
||||
if ($station_id2 == NULL) {
|
||||
$sql .= ' and ' . $this->config->item('table_name') . '.station_id = ' . $station_id;
|
||||
} else {
|
||||
$sql .= ' and ' . $this->config->item('table_name') . '.station_id = ' . $station_id2;
|
||||
}
|
||||
|
||||
$sql .= ' ORDER BY adif, col_routing';
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
return $query;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ class Qslprint_model extends CI_Model {
|
|||
parent::__construct();
|
||||
}
|
||||
|
||||
function mark_qsos_printed() {
|
||||
function mark_qsos_printed($station_id2 = NULL) {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
|
|
@ -19,17 +19,26 @@ class Qslprint_model extends CI_Model {
|
|||
);
|
||||
|
||||
$this->db->where_in("COL_QSL_SENT", array("R","Q"));
|
||||
$this->db->where("station_id", $station_id);
|
||||
|
||||
if ($station_id2 == NULL) {
|
||||
$this->db->where("station_id", $station_id);
|
||||
} else {
|
||||
$this->db->where("station_id", $station_id2);
|
||||
}
|
||||
|
||||
$this->db->update($this->config->item('table_name'), $data);
|
||||
}
|
||||
|
||||
function get_qsos_for_print() {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
/*
|
||||
* We list out the QSL's ready for print.
|
||||
* station_id is not provided when loading page.
|
||||
* It will be provided when calling the function when the dropdown is changed and the javascript fires
|
||||
*/
|
||||
function get_qsos_for_print($station_id = 'All') {
|
||||
if ($station_id != 'All') {
|
||||
$this->db->where($this->config->item('table_name').'.station_id', $station_id);
|
||||
}
|
||||
|
||||
$active_station_id = $this->stations->find_active();
|
||||
|
||||
$this->db->where($this->config->item('table_name').'.station_id', $active_station_id);
|
||||
$this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
|
||||
$this->db->where_in('COL_QSL_SENT', array('R', 'Q'));
|
||||
$this->db->order_by("COL_TIME_ON", "ASC");
|
||||
|
|
@ -38,17 +47,18 @@ class Qslprint_model extends CI_Model {
|
|||
return $query;
|
||||
}
|
||||
|
||||
function delete_from_qsl_queue($id) {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
function get_qsos_for_print_ajax($station_id) {
|
||||
$query = $this->get_qsos_for_print($station_id);
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
function delete_from_qsl_queue($id) {
|
||||
$data = array(
|
||||
'COL_QSL_SENT' => "N",
|
||||
);
|
||||
|
||||
$this->db->where("COL_PRIMARY_KEY", $id);
|
||||
//$this->db->where("station_id", $station_id);
|
||||
$this->db->update($this->config->item('table_name'), $data);
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -2026,28 +2026,38 @@ function deleteQsl(id) {
|
|||
<?php if ($this->uri->segment(1) == "qslprint") { ?>
|
||||
<script>
|
||||
function deleteFromQslQueue(id) {
|
||||
$.ajax({
|
||||
url: baseURL + 'index.php/qslprint/delete_from_qsl_queue',
|
||||
type: 'post',
|
||||
data: {'id': id
|
||||
},
|
||||
success: function(html) {
|
||||
BootstrapDialog.show({
|
||||
title: 'QSO Data',
|
||||
size: BootstrapDialog.SIZE_WIDE,
|
||||
cssClass: 'qso-counties-dialog',
|
||||
nl2br: false,
|
||||
message: html,
|
||||
buttons: [{
|
||||
label: 'Close',
|
||||
action: function (dialogItself) {
|
||||
dialogItself.close();
|
||||
}
|
||||
}]
|
||||
BootstrapDialog.confirm({
|
||||
title: 'DANGER',
|
||||
message: 'Warning! Are you sure you want to removes this QSL from the queue?',
|
||||
type: BootstrapDialog.TYPE_DANGER,
|
||||
closable: true,
|
||||
draggable: true,
|
||||
btnOKClass: 'btn-danger',
|
||||
callback: function(result) {
|
||||
$.ajax({
|
||||
url: base_url + 'index.php/qslprint/delete_from_qsl_queue',
|
||||
type: 'post',
|
||||
data: {'id': id },
|
||||
success: function(html) {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(".station_id").change(function(){
|
||||
var station_id = $(".station_id").val();
|
||||
$.ajax({
|
||||
url: base_url + 'index.php/qslprint/get_qsos_for_print_ajax',
|
||||
type: 'post',
|
||||
data: {'station_id': station_id},
|
||||
success: function(html) {
|
||||
$('.resulttable').empty();
|
||||
$('.resulttable').append(html);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php } ?>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -17,8 +17,9 @@
|
|||
</div>
|
||||
<div class="card-body">
|
||||
<form class="form" action="<?php echo site_url('adif/import'); ?>" method="post" enctype="multipart/form-data">
|
||||
<select name="station_profile" class="custom-select mb-2 mr-sm-2" style="width: 20%;">
|
||||
<option value="0">Select Station Profile</option>
|
||||
Station profile:
|
||||
<select name="station_profile" class="station_id custom-select mb-3 mr-sm-3" style="width: 20%;">
|
||||
<option value="All">All</option>
|
||||
<?php foreach ($station_profile->result() as $station) { ?>
|
||||
<option value="<?php echo $station->station_id; ?>">Callsign: <?php echo $station->station_callsign; ?> (<?php echo $station->station_profile_name; ?>)</option>
|
||||
<?php } ?>
|
||||
|
|
@ -31,7 +32,8 @@
|
|||
|
||||
|
||||
<?php
|
||||
if (is_array($qsos->result())) {
|
||||
echo '<div class="resulttable">';
|
||||
if ($qsos->result() != NULL) {
|
||||
echo '<table style="width:100%" class="table table-sm table-bordered table-hover table-striped table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
|
|
@ -58,14 +60,21 @@
|
|||
}
|
||||
|
||||
echo '</tbody></table>';
|
||||
?>
|
||||
|
||||
<p><a href="<?php echo site_url('qslprint/exportcsv/all'); ?>" title="Export CSV-file" target="_blank" class="btn btn-primary">Export requested QSLs to CSV-file</a></p>
|
||||
|
||||
<p><a href="<?php echo site_url('qslprint/exportadif/all'); ?>" title="Export ADIF" target="_blank" class="btn btn-primary">Export requested QSLs to ADIF-file</a></p>
|
||||
|
||||
<p><a href="<?php echo site_url('qslprint/qsl_printed/all'); ?>" title="Mark QSLs as printed" target="_blank" class="btn btn-primary">Mark requested QSLs as sent</a></p>
|
||||
|
||||
<?php
|
||||
} else {
|
||||
echo '<div class="alert alert-danger"><a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>No QSL\'s to print were found!</div>';
|
||||
}
|
||||
?>
|
||||
|
||||
<p><a href="<?php echo site_url('qslprint/exportcsv'); ?>" title="Export CSV-file" target="_blank" class="btn btn-primary">Export requested QSLs to CSV-file</a></p>
|
||||
|
||||
<p><a href="<?php echo site_url('qslprint/exportadif'); ?>" title="Export ADIF" target="_blank" class="btn btn-primary">Export requested QSLs to ADIF-file</a></p>
|
||||
|
||||
<p><a href="<?php echo site_url('qslprint/qsl_printed'); ?>" title="Mark QSLs as printed" target="_blank" class="btn btn-primary">Mark requested QSLs as sent</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
if ($qsos->result() != NULL) {
|
||||
echo '<table style="width:100%" class="table table-sm table-bordered table-hover table-striped table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style=\'text-align: center\'>'.$this->lang->line('gen_hamradio_callsign').'</th>
|
||||
<th style=\'text-align: center\'>Date</th>
|
||||
<th style=\'text-align: center\'>Time</th>
|
||||
<th style=\'text-align: center\'>Mode</th>
|
||||
<th style=\'text-align: center\'>Band</th>
|
||||
<th style=\'text-align: center\'>Station</th>
|
||||
<th style=\'text-align: center\'></th>
|
||||
</tr>
|
||||
</thead><tbody>';
|
||||
|
||||
foreach ($qsos->result() as $qsl) {
|
||||
echo '<tr>';
|
||||
echo '<td style=\'text-align: center\'>' . $qsl->COL_CALL . '</td>';
|
||||
echo '<td style=\'text-align: center\'>' . $qsl->COL_TIME_ON . '</td>';
|
||||
echo '<td style=\'text-align: center\'>' . $qsl->COL_TIME_ON . '</td>';
|
||||
echo '<td style=\'text-align: center\'>'; if($qsl->COL_SAT_NAME != null) { echo $qsl->COL_SAT_NAME; } else { echo strtolower($qsl->COL_BAND); }; echo '</td>';
|
||||
echo '<td style=\'text-align: center\'>'; echo $qsl->COL_SUBMODE==null?$qsl->COL_MODE:$qsl->COL_SUBMODE; echo '</td>';
|
||||
echo '<td style=\'text-align: center\'><span class="badge badge-light">' . $qsl->station_callsign . '</span></td>';
|
||||
echo '<td id="'.$qsl->COL_PRIMARY_KEY.'" style=\'text-align: center\'><button onclick="deleteFromQslQueue(\''.$qsl->COL_PRIMARY_KEY.'\')" class="btn btn-sm btn-danger">Delete from queue</button></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
echo '</tbody></table>';
|
||||
?>
|
||||
|
||||
<p><a href="<?php echo site_url('qslprint/exportcsv/' . $station_id); ?>" title="Export CSV-file" target="_blank" class="btn btn-primary">Export requested QSLs to CSV-file</a></p>
|
||||
|
||||
<p><a href="<?php echo site_url('qslprint/exportadif/' . $station_id); ?>" title="Export ADIF" target="_blank" class="btn btn-primary">Export requested QSLs to ADIF-file</a></p>
|
||||
|
||||
<p><a href="<?php echo site_url('qslprint/qsl_printed/' . $station_id); ?>" title="Mark QSLs as printed" target="_blank" class="btn btn-primary">Mark requested QSLs as sent</a></p>
|
||||
|
||||
<?php
|
||||
} else {
|
||||
echo '<div class="alert alert-danger"><a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>No QSL\'s to print were found!</div>';
|
||||
}
|
||||
?>
|
||||
正在加载…
在新工单中引用