Disable HRDLog-Upload if credentials are obviously wrong

This commit is contained in:
int2001
2024-10-04 06:36:58 +00:00
parent 43d85ce0dd
commit 3ae02b052b
4 changed files with 117 additions and 105 deletions

View File

@@ -72,8 +72,9 @@ class Hrdlog_model extends CI_Model {
} elseif ((substr($result['status'], 0, 11) == 'auth_error')) {
log_message('error', 'hrdlog upload failed for qso: Call: ' . $qso->COL_CALL . ' Band: ' . $qso->COL_BAND . ' Mode: ' . $qso->COL_MODE . ' Time: ' . $qso->COL_TIME_ON);
log_message('error', 'hrdlog upload failed with the following message: ' . $result['message']);
log_message('error', 'hrdlog upload stopped for Station_ID: ' . $station_id);
log_message('error', 'hrdlog upload stopped and disabled for Station_ID: ' . $station_id);
$errormessages[] = $result['message'] . 'Invalid HRDLog-Code, stopped at Call: ' . $qso->COL_CALL . ' Band: ' . $qso->COL_BAND . ' Mode: ' . $qso->COL_MODE . ' Time: ' . $qso->COL_TIME_ON;
$this->disable_hrdlog_station($station_id);
$result['status'] = 'Error';
break; /* If key is invalid, immediate stop syncing for more QSOs of this station */
} else {
@@ -116,6 +117,13 @@ class Hrdlog_model extends CI_Model {
return 0;
}
function disable_hrdlog_station($station_id) {
$sql='update station_profile set hrdlogrealtime=-1 where station_id=?';
$bindings=[$station_id];
$this->db->query($sql,$bindings);
return;
}
/*
* Function marks QSO with given primarykey as uploaded to hrdlog
*/

View File

@@ -815,7 +815,7 @@ class Logbook_model extends CI_Model {
*/
function exists_hrdlog_credentials($station_id) {
$sql = 'select hrdlog_username, hrdlog_code, hrdlogrealtime from station_profile
where station_id = ?';
where station_id = ? and hrdlogrealtime>=0';
$query = $this->db->query($sql, $station_id);
@@ -1922,7 +1922,8 @@ class Logbook_model extends CI_Model {
' left join station_profile on thcv.station_id = station_profile.station_id' .
' left outer join dxcc_entities on thcv.col_my_dxcc = dxcc_entities.adif' .
' where thcv.station_id = ?' .
' and (COL_HRDLOG_QSO_UPLOAD_STATUS is NULL
' and station_profile.hrdlogrealtime>=0
and (COL_HRDLOG_QSO_UPLOAD_STATUS is NULL
or COL_HRDLOG_QSO_UPLOAD_STATUS = ""
or COL_HRDLOG_QSO_UPLOAD_STATUS = "M"
or COL_HRDLOG_QSO_UPLOAD_STATUS = "N")';
@@ -2034,6 +2035,7 @@ class Logbook_model extends CI_Model {
$sql = 'SELECT station_id, hrdlog_username, hrdlog_code, station_callsign
FROM station_profile
WHERE coalesce(hrdlog_username, "") <> ""
AND hrdlogrealtime>=0
AND coalesce(hrdlog_code, "") <> ""';
$query = $this->db->query($sql);

View File

@@ -242,6 +242,7 @@ if ($dxcc_list->result() > 0) {
<select class="form-select" id="hrdlogrealtime" name="hrdlogrealtime">
<option value="1"><?= __("Yes"); ?></option>
<option value="0" selected><?= __("No"); ?></option>
<option value="-1" selected><?= __("Disabled"); ?></option>
</select>
</div>
</div>

View File

@@ -390,6 +390,7 @@ if ($dxcc_list->result() > 0) {
<select class="form-select" id="hrdlogrealtime" name="hrdlogrealtime">
<option value="1" <?php if ($my_station_profile->hrdlogrealtime == 1) { echo " selected =\"selected\""; } ?>><?= __("Yes"); ?></option>
<option value="0" <?php if ($my_station_profile->hrdlogrealtime == 0) { echo " selected =\"selected\""; } ?>><?= __("No"); ?></option>
<option value="0" <?php if ($my_station_profile->hrdlogrealtime == -1) { echo " selected =\"selected\""; } ?>><?= __("Disabled"); ?></option>
</select>
</div>
</div>