From 782857aef9f5b1b48950737a46c10354c9386397 Mon Sep 17 00:00:00 2001 From: int2001 Date: Wed, 5 Jul 2023 12:05:02 +0000 Subject: [PATCH 1/3] Fixes Issue 2198 --- application/controllers/Qrz.php | 7 ++++++- application/models/Logbook_model.php | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/application/controllers/Qrz.php b/application/controllers/Qrz.php index 13d35421..1df7e220 100644 --- a/application/controllers/Qrz.php +++ b/application/controllers/Qrz.php @@ -71,9 +71,14 @@ class Qrz extends CI_Controller { $result = $this->logbook_model->push_qso_to_qrz($qrz_api_key, $adif); } - if ($result['status'] == 'OK') { + if ( ($result['status'] == 'OK') || ( ($result['status'] == 'error') && ($result['message'] == 'STATUS=FAIL&REASON=Unable to add QSO to database: duplicate&EXTENDED=')) ){ $this->markqso($qso->COL_PRIMARY_KEY); $i++; + } elseif ( ($result['status']=='error') && (substr($result['message'],0,11) == 'STATUS=AUTH')) { + log_message('error', 'QRZ upload failed for qso: Call: ' . $qso->COL_CALL . ' Band: ' . $qso->COL_BAND . ' Mode: ' . $qso->COL_MODE . ' Time: ' . $qso->COL_TIME_ON); + log_message('error', 'QRZ upload failed with the following message: ' .$result['message']); + log_message('error', 'QRZ upload stopped for Station_ID: ' .$station_id); + break; /* If key is invalid, immediate stop syncing for more QSOs of this station */ } else { log_message('error', 'QRZ upload failed for qso: Call: ' . $qso->COL_CALL . ' Band: ' . $qso->COL_BAND . ' Mode: ' . $qso->COL_MODE . ' Time: ' . $qso->COL_TIME_ON); log_message('error', 'QRZ upload failed with the following message: ' .$result['message']); diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 7900a6ca..691cb3ba 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -519,7 +519,8 @@ class Logbook_model extends CI_Model { $adif = $CI->adifhelper->getAdifLine($qso[0]); $result = $this->push_qso_to_qrz($result->qrzapikey, $adif); - if ($result['status'] == 'OK') { + log_message("error","Oink: ".$result['message']); + if ( ($result['status'] == 'OK') || ( ($result['status'] == 'error') && ($result['message'] == 'STATUS=FAIL&REASON=Unable to add QSO to database: duplicate&EXTENDED=')) ){ $this->mark_qrz_qsos_sent($last_id); } } From 8c04f5ecc27f7b2b7b7d681f895408553e3c6556 Mon Sep 17 00:00:00 2001 From: int2001 Date: Wed, 5 Jul 2023 12:07:00 +0000 Subject: [PATCH 2/3] Removed debug-Output --- application/models/Logbook_model.php | 1 - 1 file changed, 1 deletion(-) diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 691cb3ba..c7b97e05 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -519,7 +519,6 @@ class Logbook_model extends CI_Model { $adif = $CI->adifhelper->getAdifLine($qso[0]); $result = $this->push_qso_to_qrz($result->qrzapikey, $adif); - log_message("error","Oink: ".$result['message']); if ( ($result['status'] == 'OK') || ( ($result['status'] == 'error') && ($result['message'] == 'STATUS=FAIL&REASON=Unable to add QSO to database: duplicate&EXTENDED=')) ){ $this->mark_qrz_qsos_sent($last_id); } From 5ffcc413e9daf6e0757c156163a72369a86678d1 Mon Sep 17 00:00:00 2001 From: int2001 Date: Wed, 5 Jul 2023 12:20:39 +0000 Subject: [PATCH 3/3] Added Errormessage for User in case of invalid/expired key --- application/controllers/Qrz.php | 1 + 1 file changed, 1 insertion(+) diff --git a/application/controllers/Qrz.php b/application/controllers/Qrz.php index 1df7e220..68eb29db 100644 --- a/application/controllers/Qrz.php +++ b/application/controllers/Qrz.php @@ -78,6 +78,7 @@ class Qrz extends CI_Controller { log_message('error', 'QRZ upload failed for qso: Call: ' . $qso->COL_CALL . ' Band: ' . $qso->COL_BAND . ' Mode: ' . $qso->COL_MODE . ' Time: ' . $qso->COL_TIME_ON); log_message('error', 'QRZ upload failed with the following message: ' .$result['message']); log_message('error', 'QRZ upload stopped for Station_ID: ' .$station_id); + $errormessages[] = $result['message'] . ' Call: ' . $qso->COL_CALL . ' Band: ' . $qso->COL_BAND . ' Mode: ' . $qso->COL_MODE . ' Time: ' . $qso->COL_TIME_ON; break; /* If key is invalid, immediate stop syncing for more QSOs of this station */ } else { log_message('error', 'QRZ upload failed for qso: Call: ' . $qso->COL_CALL . ' Band: ' . $qso->COL_BAND . ' Mode: ' . $qso->COL_MODE . ' Time: ' . $qso->COL_TIME_ON);