kopia lustrzana https://github.com/magicbug/Cloudlog
Bugfix: don't duplicate 'Mark as Uploaded' records
rodzic
18b1417172
commit
f4ea93ba89
|
@ -91,7 +91,7 @@ class Webadif extends CI_Controller {
|
|||
|
||||
$data['page_title'] = "QO-100 Dx Club Upload";
|
||||
|
||||
$data['station_profiles'] = $this->stations->all_of_user();
|
||||
$data['station_profiles'] = $this->stations->stations_with_webadif_api_key();
|
||||
$data['station_profile'] = $this->stations->stations_with_webadif_api_key();
|
||||
|
||||
$this->load->view('interface_assets/header', $data);
|
||||
|
@ -137,12 +137,17 @@ class Webadif extends CI_Controller {
|
|||
$data['page_title'] = "QO-100 Dx Club Upload";
|
||||
|
||||
$station_id = $this->security->xss_clean($this->input->post('station_profile'));
|
||||
|
||||
$this->load->model('adif_data');
|
||||
|
||||
$data['qsos'] = $this->adif_data->export_custom($this->input->post('from'), $this->input->post('to'), $station_id);
|
||||
$from = $this->security->xss_clean($this->input->post('from'));
|
||||
$to = $this->security->xss_clean($this->input->post('to'));
|
||||
|
||||
$this->load->model('logbook_model');
|
||||
|
||||
$data['qsos'] = $this->logbook_model->get_webadif_qsos(
|
||||
$station_id,
|
||||
$from,
|
||||
$to
|
||||
);
|
||||
|
||||
if ($data['qsos']!==null) {
|
||||
foreach ($data['qsos']->result() as $qso) {
|
||||
$this->logbook_model->mark_webadif_qsos_sent($qso->COL_PRIMARY_KEY);
|
||||
|
|
|
@ -1278,9 +1278,10 @@ class Logbook_model extends CI_Model {
|
|||
/*
|
||||
* Function returns the QSOs from the logbook, which have not been either marked as uploaded to webADIF
|
||||
*/
|
||||
function get_webadif_qsos($station_id){
|
||||
function get_webadif_qsos($station_id,$from, $to){
|
||||
$sql = "
|
||||
SELECT qsos.*, station_profile.* FROM %s qsos
|
||||
SELECT qsos.*, station_profile.*
|
||||
FROM %s qsos
|
||||
INNER JOIN station_profile ON qsos.station_id = station_profile.station_id
|
||||
LEFT JOIN webadif ON qsos.COL_PRIMARY_KEY = webadif.qso_id
|
||||
WHERE qsos.station_id = %d
|
||||
|
@ -1291,6 +1292,27 @@ class Logbook_model extends CI_Model {
|
|||
$this->config->item('table_name'),
|
||||
$station_id
|
||||
);
|
||||
if ($from) {
|
||||
$from = DateTime::createFromFormat('d/m/Y', $from);
|
||||
$from = $from->format('Y-m-d');
|
||||
|
||||
$sql.=" AND qsos.COL_TIME_ON >= %s";
|
||||
$sql=sprintf(
|
||||
$sql,
|
||||
$this->db->escape($from)
|
||||
);
|
||||
}
|
||||
if ($to) {
|
||||
$to = DateTime::createFromFormat('d/m/Y', $to);
|
||||
$to = $to->format('Y-m-d');
|
||||
|
||||
$sql.=" AND qsos.COL_TIME_ON <= %s";
|
||||
$sql=sprintf(
|
||||
$sql,
|
||||
$this->db->escape($to)
|
||||
);
|
||||
}
|
||||
|
||||
return $this->db->query($sql);
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue