Merge pull request #2383 from int2001/clublog_checkbox

Added "Already imported to clublog" to ADIF-Importer
pull/2389/head
Peter Goodhall 2023-08-07 10:14:07 +01:00 zatwierdzone przez GitHub
commit d4ce0b8077
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
4 zmienionych plików z 43 dodań i 13 usunięć

Wyświetl plik

@ -200,7 +200,7 @@ class adif extends CI_Controller {
break;
};
$one_error = $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('markHrd'), true, $this->input->post('operatorName'));
$one_error = $this->logbook_model->import($record, $this->input->post('station_profile'), $this->input->post('skipDuplicate'), $this->input->post('markClublog'),$this->input->post('markLotw'), $this->input->post('dxccAdif'), $this->input->post('markQrz'), $this->input->post('markHrd'), true, $this->input->post('operatorName'));
if ($one_error != '') {
$custom_errors.=$one_error."<br/>";
}

Wyświetl plik

@ -461,7 +461,7 @@ class API extends CI_Controller {
if(isset($obj['station_profile_id'])) {
$this->logbook_model->import($record, $obj['station_profile_id'], NULL, NULL, NULL, NULL, NULL, false, false, true);
$this->logbook_model->import($record, $obj['station_profile_id'], NULL, NULL, NULL, NULL, NULL, NULL, false, false, true);
}
};

Wyświetl plik

@ -2776,7 +2776,7 @@ class Logbook_model extends CI_Model {
* $markHrd - used in ADIF import to mark QSOs as exported to HRDLog.net 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 = false, $markLotw = false, $dxccAdif = false, $markQrz = false, $markHrd = false,$skipexport = false, $operatorName = false, $apicall = false) {
function import($record, $station_id = "0", $skipDuplicate = false, $markClublog = false, $markLotw = false, $dxccAdif = false, $markQrz = false, $markHrd = false,$skipexport = false, $operatorName = false, $apicall = false) {
// be sure that station belongs to user
$CI =& get_instance();
$CI->load->model('stations');
@ -3031,6 +3031,26 @@ class Logbook_model extends CI_Model {
$input_qsl_sent_via = "";
}
// Validate Clublog-Fields
if (isset($record['clublog_qso_upload_status'])){
$input_clublog_qsl_sent = mb_strimwidth($record['clublog_qso_upload_status'], 0, 1);
} else if ($markClublog != NULL) {
$input_clublog_qsl_sent = "Y";
} else {
$input_clublog_qsl_sent = NULL;
}
if (isset($record['clublog_qso_upload_date'])){
if(validateADIFDate($record['clublog_qso_upload_date']) == true){
$input_clublog_qslsdate = $record['clublog_qso_upload_date'];
} else {
$input_clublog_qslsdate = NULL;
$my_error .= "Error QSO: Date: ".$time_on." Callsign: ".$record['call']." the clublog_qso_upload_date is invalid (YYYYMMDD): ".$record['clublog_qso_upload_date']."<br>";
}
} else {
$input_clublog_qslsdate = NULL;
}
/*
Validate LoTW Fields
*/
@ -3040,14 +3060,6 @@ class Logbook_model extends CI_Model {
$input_lotw_qsl_rcvd = NULL;
}
if (isset($record['lotw_qsl_sent'])){
$input_lotw_qsl_sent = mb_strimwidth($record['lotw_qsl_sent'], 0, 1);
} else if ($markLotw != NULL) {
$input_lotw_qsl_sent = "Y";
} else {
$input_lotw_qsl_sent = NULL;
}
if (isset($record['lotw_qslrdate'])){
if(validateADIFDate($record['lotw_qslrdate']) == true){
$input_lotw_qslrdate = $record['lotw_qslrdate'];
@ -3058,6 +3070,14 @@ class Logbook_model extends CI_Model {
} else {
$input_lotw_qslrdate = NULL;
}
if (isset($record['lotw_qsl_sent'])){
$input_lotw_qsl_sent = mb_strimwidth($record['lotw_qsl_sent'], 0, 1);
} else if ($markLotw != NULL) {
$input_lotw_qsl_sent = "Y";
} else {
$input_lotw_qsl_sent = NULL;
}
if (isset($record['lotw_qslsdate'])){
if(validateADIFDate($record['lotw_qslsdate']) == true){
@ -3163,8 +3183,8 @@ class Logbook_model extends CI_Model {
'COL_CALL' => (!empty($record['call'])) ? strtoupper($record['call']) : '',
'COL_CHECK' => (!empty($record['check'])) ? $record['check'] : '',
'COL_CLASS' => (!empty($record['class'])) ? $record['class'] : '',
'COL_CLUBLOG_QSO_UPLOAD_DATE' => (!empty($record['clublog_qso_upload_date'])) ? $record['clublog_qso_upload_date'] : null,
'COL_CLUBLOG_QSO_UPLOAD_STATUS' => (!empty($record['clublog_qso_upload_status'])) ? $record['clublog_qso_upload_status'] : null,
'COL_CLUBLOG_QSO_UPLOAD_DATE' => $input_clublog_qslsdate,
'COL_CLUBLOG_QSO_UPLOAD_STATUS' => $input_clublog_qsl_sent,
'COL_CNTY' => (!empty($record['cnty'])) ? $record['cnty'] : '',
'COL_COMMENT' => (!empty($record['comment'])) ? $record['comment'] : '',
'COL_COMMENT_INTL' => (!empty($record['comment_intl'])) ? $record['comment_intl'] : '',

Wyświetl plik

@ -79,6 +79,16 @@
</div>
</div>
<div class="form-group row">
<div class="col-md-10">
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" name="markClublog" value="1" id="markClublogImport">
<label class="form-check-label" for="markClublogImport">Mark imported QSOs as uploaded to Clublog Logbook</label>
</div>
<div class="small form-text text-muted">Select if ADIF being imported does not contain this information.</div>
</div>
</div>
<div class="form-group row">
<div class="col-md-10">
<div class="form-check-inline">