From ae1c82815f5c8889ce3810a8e76a9bed4a6ff508 Mon Sep 17 00:00:00 2001 From: Andreas Date: Fri, 11 Dec 2020 10:49:33 +0100 Subject: [PATCH 1/2] [ADIF import] Skip QRZ Logbook upload when importing ADIF from import, and LoTW. --- application/controllers/Adif.php | 2 +- application/controllers/Api.php | 4 ++-- application/controllers/Lotw.php | 2 +- application/models/Logbook_model.php | 19 +++++++++++++------ 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/application/controllers/Adif.php b/application/controllers/Adif.php index b9393ef1..5ef077ae 100644 --- a/application/controllers/Adif.php +++ b/application/controllers/Adif.php @@ -221,7 +221,7 @@ class adif extends CI_Controller { $custom_errors .= $this->logbook_model->import($record, $this->input->post('station_profile'), - $this->input->post('skipDuplicate'), $this->input->post('markLotw'), $this->input->post('dxccAdif'), $this->input->post('markQrz')); + $this->input->post('skipDuplicate'), $this->input->post('markLotw'), $this->input->post('dxccAdif'), $this->input->post('markQrz'), true); }; diff --git a/application/controllers/Api.php b/application/controllers/Api.php index c8bc5c4b..9db17851 100644 --- a/application/controllers/Api.php +++ b/application/controllers/Api.php @@ -429,9 +429,9 @@ class API extends CI_Controller { if(isset($obj['station_profile_id'])) { - $this->logbook_model->import($record, $obj['station_profile_id'], NULL, NULL, NULL, NULL); + $this->logbook_model->import($record, $obj['station_profile_id'], NULL, NULL, NULL, NULL, false); } else { - $this->logbook_model->import($record, 0, NULL, NULL, NULL, NULL); + $this->logbook_model->import($record, 0, NULL, NULL, NULL, NULL, false); } }; diff --git a/application/controllers/Lotw.php b/application/controllers/Lotw.php index 137b489d..e8ec6bfd 100644 --- a/application/controllers/Lotw.php +++ b/application/controllers/Lotw.php @@ -489,7 +489,7 @@ class Lotw extends CI_Controller { $station_id = $this->logbook_model->find_correct_station_id($record['station_callsign'], $record['my_gridsquare']); if ($station_id != NULL) { - $result = $this->logbook_model->import($record, $station_id, NULL, NULL, NULL, NULL); // Create the Entry + $result = $this->logbook_model->import($record, $station_id, NULL, NULL, NULL, NULL, true); // Create the Entry if ($result == "") { $lotw_status = 'QSO imported'; } else { diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 481e039c..1b5b6364 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -204,7 +204,7 @@ class Logbook_model extends CI_Model { $data['COL_LOTW_QSL_RCVD'] = 'N'; } - $this->add_qso($data); + $this->add_qso($data, $skipexport = false); } public function check_station($id){ @@ -350,7 +350,7 @@ class Logbook_model extends CI_Model { } - function add_qso($data) { + function add_qso($data, $skipexport = false) { if ($data['COL_DXCC'] == "Not Found"){ $data['COL_DXCC'] = NULL; @@ -367,8 +367,8 @@ class Logbook_model extends CI_Model { $result = $this->exists_qrz_api_key($data['station_id']); - // Push qso to qrz if apikey is set, and realtime upload is enabled - if (isset($result->qrzapikey) && $result->qrzrealtime == 1) { + // Push qso to qrz if apikey is set, and realtime upload is enabled, and we're not importing an adif-file + if (isset($result->qrzapikey) && $result->qrzrealtime == 1 && !$skipexport) { $CI =& get_instance(); $CI->load->library('AdifHelper'); $qso = $this->get_qso($last_id)->result(); @@ -1454,7 +1454,14 @@ class Logbook_model extends CI_Model { return $this->db->get(); } - function import($record, $station_id = "0", $skipDuplicate, $markLotw, $dxccAdif, $markQrz) { + /* + * $skipDuplicate - used in ADIF import to skip duplicate checking when importing QSOs + * $markLoTW - used in ADIF import to mark QSOs as exported to LoTW when importing QSOs + * $dxccAdif - used in ADIF import to determine if DXCC From ADIF is used, or if Cloudlog should try to guess + * $markLoTW - used in ADIF import to mark QSOs as exported to QRZ Logbook when importing QSOs + * $skipexport - used in ADIF import to skip the realtime upload to QRZ Logbook when importing QSOs from ADIF + */ + function import($record, $station_id = "0", $skipDuplicate, $markLotw, $dxccAdif, $markQrz, $skipexport = false) { $CI =& get_instance(); $CI->load->library('frequency'); $my_error = ""; @@ -1955,7 +1962,7 @@ class Logbook_model extends CI_Model { } // Save QSO - $this->add_qso($data); + $this->add_qso($data, $skipexport); } else { $my_error .= "Date/Time: ".$time_on." Callsign: ".$record['call']." Band: ".$band." Duplicate
"; } From bcb9ab7047b066de4fe89b5bd5bbd96af5a00bc9 Mon Sep 17 00:00:00 2001 From: Andreas Date: Thu, 24 Dec 2020 10:53:29 +0100 Subject: [PATCH 2/2] Fixed a typo. --- application/models/Logbook_model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 1b5b6364..e60860d7 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -1458,7 +1458,7 @@ class Logbook_model extends CI_Model { * $skipDuplicate - used in ADIF import to skip duplicate checking when importing QSOs * $markLoTW - used in ADIF import to mark QSOs as exported to LoTW when importing QSOs * $dxccAdif - used in ADIF import to determine if DXCC From ADIF is used, or if Cloudlog should try to guess - * $markLoTW - used in ADIF import to mark QSOs as exported to QRZ Logbook when importing QSOs + * $markQrz - used in ADIF import to mark QSOs as exported to QRZ Logbook when importing QSOs * $skipexport - used in ADIF import to skip the realtime upload to QRZ Logbook when importing QSOs from ADIF */ function import($record, $station_id = "0", $skipDuplicate, $markLotw, $dxccAdif, $markQrz, $skipexport = false) {