diff --git a/application/controllers/Adif.php b/application/controllers/Adif.php
index 0c73b83cd..e3386fe02 100644
--- a/application/controllers/Adif.php
+++ b/application/controllers/Adif.php
@@ -220,11 +220,11 @@ class adif extends CI_Controller {
$fdata['upload_data']=''; // free memory
$this->adif_parser->initialize();
- $custom_errors = "";
- $alladif=[];
+ $custom_errors['errormessage'] = "";
+ $alladif = [];
$contest_qso_infos = [];
while($record = $this->adif_parser->get_record()) {
-
+
//overwrite the contest id if user chose a contest in UI
if ($contest != '') {
$record['contest_id'] = $contest;
@@ -250,7 +250,7 @@ class adif extends CI_Controller {
if(count($record) == 0) {
break;
};
- array_push($alladif,$record);
+ array_push($alladif, $record);
};
$record=''; // free memory
try {
@@ -271,11 +271,12 @@ class adif extends CI_Controller {
return;
}
} else {
- $custom_errors=__("Station Profile not valid for User");
+ $custom_errors['errormessage'] = __("Station Profile not valid for User");
}
log_message("Error","ADIF End");
- $data['adif_errors'] = $custom_errors;
+ $data['adif_errors'] = $custom_errors['errormessage'];
+ $data['qsocount'] = $custom_errors['qsocount'] ?? 0;
$data['skip_dupes'] = $this->input->post('skipDuplicate');
$data['imported_contests'] = $contest_qso_infos;
diff --git a/application/controllers/Api.php b/application/controllers/Api.php
index 8797a47b9..e28d2dfe0 100644
--- a/application/controllers/Api.php
+++ b/application/controllers/Api.php
@@ -277,7 +277,8 @@ class API extends CI_Controller {
};
$record=''; // free memory
gc_collect_cycles();
- $custom_errors = $this->logbook_model->import_bulk($alladif, $obj['station_profile_id'], false, false, false, false, false, false, false, false, true, false, true, false);
+ $result = $this->logbook_model->import_bulk($alladif, $obj['station_profile_id'], false, false, false, false, false, false, false, false, true, false, true, false);
+ $custom_errors = $result['errormessage'];
if ($custom_errors) {
$adif_errors++;
}
diff --git a/application/controllers/Simplefle.php b/application/controllers/Simplefle.php
index bf7d6ef03..c51f3d068 100644
--- a/application/controllers/Simplefle.php
+++ b/application/controllers/Simplefle.php
@@ -12,7 +12,7 @@ class SimpleFLE extends CI_Controller {
$this->load->model('modes');
$this->load->model('bands');
$this->load->model('contesting_model');
-
+
$data['contests']=$this->contesting_model->getActivecontests();
$data['station_profile'] = $this->stations->all_of_user(); // Used in the view for station location select
$data['bands'] = $this->bands->get_all_bands(); // Fetching Bands for SFLE
@@ -84,7 +84,8 @@ class SimpleFLE extends CI_Controller {
$qsos = json_decode($qsos, true);
$station_id = $qsos[0]['station_id']; // we can trust this value
- $bulk_result = $this->logbook_model->import_bulk($qsos, $station_id);
+ $result = $this->logbook_model->import_bulk($qsos, $station_id);
+ $bulk_result = $result['errormessage'];
$clean_result = str_replace(['
'], "\n", $bulk_result);
log_message('debug', "SimpleFLE, save_qsos(); Bulk Result: \n" . $clean_result);
@@ -101,5 +102,5 @@ class SimpleFLE extends CI_Controller {
echo json_encode($result);
}
}
-
+
}
diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php
index 931064502..4c88a13df 100644
--- a/application/models/Logbook_model.php
+++ b/application/models/Logbook_model.php
@@ -3918,7 +3918,7 @@ class Logbook_model extends CI_Model {
function import_bulk($records, $station_id = "0", $skipDuplicate = false, $markClublog = false, $markLotw = false, $dxccAdif = false, $markQrz = false, $markEqsl = false, $markHrd = false, $markDcl = false, $skipexport = false, $operatorName = false, $apicall = false, $skipStationCheck = false) {
$this->load->model('user_model');
- $custom_errors = '';
+ $custom_errors['errormessage'] = '';
$a_qsos = [];
$amsat_qsos = [];
$today = time();
@@ -3935,7 +3935,7 @@ class Logbook_model extends CI_Model {
foreach ($records as $record) {
$one_error = $this->import($record, $station_id, $skipDuplicate, $markClublog, $markLotw, $dxccAdif, $markQrz, $markEqsl, $markHrd, $markDcl, $skipexport, trim($operatorName), $apicall, $skipStationCheck, true, $station_id_ok, $station_profile, $station_qslmsg);
if ($one_error['error'] ?? '' != '') {
- $custom_errors .= $one_error['error'] . "
";
+ $custom_errors['errormessage'] .= $one_error['error'];
} else { // No Errors / QSO doesn't exist so far
array_push($a_qsos, $one_error['raw_qso'] ?? '');
if (isset($record['prop_mode']) && $record['prop_mode'] == 'SAT' && $amsat_status_upload) {
@@ -3965,7 +3965,8 @@ class Logbook_model extends CI_Model {
$records = '';
gc_collect_cycles();
- if (count($a_qsos) > 0) {
+ $custom_errors['qsocount'] = count($a_qsos);
+ if ($custom_errors['qsocount'] > 0) {
$this->db->insert_batch($this->config->item('table_name'), $a_qsos);
}
foreach ($amsat_qsos as $amsat_qso) {
@@ -4001,9 +4002,9 @@ class Logbook_model extends CI_Model {
$record['station_callsign'] = $station_profile_call;
}
if ((!$skipStationCheck) && ($station_id != 0) && (trim(strtoupper($record['station_callsign'])) != trim(strtoupper($station_profile_call)))) { // Check if station_call from import matches profile ONLY when submitting via GUI.
- $returner['error'] =sprintf(__("Wrong station callsign %s while importing QSO with %s for %s: SKIPPED") .
- "
".__("Check %s for hints about errors in ADIF files."),
- ''.htmlentities($record['station_callsign'] ?? '').'',($record['call'] ?? ''),''.($station_profile_call ?? '').'',"Wavelog Wiki");
+ $returner['error'] = sprintf(__("Wrong station callsign %s while importing QSO with %s for %s: SKIPPED") .
+ "
",
+ ''.htmlentities($record['station_callsign'] ?? '').'',($record['call'] ?? ''),''.($station_profile_call ?? '').'');
return ($returner);
}
diff --git a/application/views/adif/import_success.php b/application/views/adif/import_success.php
index c59939e81..efe2a858f 100644
--- a/application/views/adif/import_success.php
+++ b/application/views/adif/import_success.php
@@ -1,31 +1,40 @@
-
= __("The ADIF File has been imported.") ?>
++ = __("Number of QSOs imported:") ?> = $qsocount ?> +
- -= __("The ADIF File has been imported.")?> + +
+ + = __("Dupes were inserted!") ?> + + = __("Dupes were skipped.") ?> + +
- - " . __("Dupes were inserted!") . ""; - } else { - echo " ".__("Dupes were skipped."); - } ?> - - - + 0) {?>= __("You might have ADIF errors, the QSOs have still been added. Please check the following information:")?>
- - -= __("You might have ADIF errors, the QSOs have still been added. Please check the following information:") ?>
+ += $adif_errors ?>+