diff --git a/application/controllers/Adif.php b/application/controllers/Adif.php index bd43b69a..e464d9e7 100644 --- a/application/controllers/Adif.php +++ b/application/controllers/Adif.php @@ -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."
"; } diff --git a/application/controllers/Api.php b/application/controllers/Api.php index 4c371ea2..595f38dd 100644 --- a/application/controllers/Api.php +++ b/application/controllers/Api.php @@ -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); } }; diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 3c27aff0..6c161113 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -2764,7 +2764,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'); @@ -3019,6 +3019,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']."
"; + } + } else { + $input_clublog_qslsdate = NULL; + } + /* Validate LoTW Fields */ @@ -3028,14 +3048,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']; @@ -3046,6 +3058,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){ @@ -3151,8 +3171,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'] : '', diff --git a/application/views/adif/import.php b/application/views/adif/import.php index 5b7b5081..90b45ed4 100644 --- a/application/views/adif/import.php +++ b/application/views/adif/import.php @@ -79,6 +79,16 @@ +
+
+
+ + +
+
Select if ADIF being imported does not contain this information.
+
+
+