mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Merge pull request #2258 from AndreasK79/adif_import_count
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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++;
|
||||
}
|
||||
|
||||
@@ -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(['<br><br/>'], "\n", $bulk_result);
|
||||
log_message('debug', "SimpleFLE, save_qsos(); Bulk Result: \n" . $clean_result);
|
||||
@@ -95,11 +96,11 @@ class SimpleFLE extends CI_Controller {
|
||||
}
|
||||
$this->staticmap_model->remove_static_map_image($station_id);
|
||||
|
||||
if (empty($result)) {
|
||||
if (empty($bulk_result)) {
|
||||
echo "success";
|
||||
} else {
|
||||
echo json_encode($result);
|
||||
echo json_encode($bulk_result);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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'] . "<br/>";
|
||||
$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") .
|
||||
"<br>".__("Check %s for hints about errors in ADIF files."),
|
||||
'<b>'.htmlentities($record['station_callsign'] ?? '').'</b>',($record['call'] ?? ''),'<b>'.($station_profile_call ?? '').'</b>',"<a target=\"_blank\" href=\"https://github.com/wavelog/Wavelog/wiki/ADIF-file-can't-be-imported\">Wavelog Wiki</a>");
|
||||
$returner['error'] = sprintf(__("Wrong station callsign %s while importing QSO with %s for %s: SKIPPED") .
|
||||
"<br>",
|
||||
'<b>'.htmlentities($record['station_callsign'] ?? '').'</b>',($record['call'] ?? ''),'<b>'.($station_profile_call ?? '').'</b>');
|
||||
return ($returner);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,31 +1,40 @@
|
||||
<div class="container">
|
||||
<br>
|
||||
<?php if($this->session->flashdata('message')) { ?>
|
||||
<!-- Display Message -->
|
||||
<div class="alert-message error">
|
||||
<p><?php echo $this->session->flashdata('message'); ?></p>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="container my-5">
|
||||
<?php if($this->session->flashdata('message')): ?>
|
||||
<!-- Display Flash Message -->
|
||||
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||
<?= $this->session->flashdata('message'); ?>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<?= __("ADIF Imported")?>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="card shadow-lg border-0 rounded-3">
|
||||
<div class="card-header bg-success text-white fw-bold">
|
||||
<?= __("ADIF Imported") ?>
|
||||
</div>
|
||||
<div class="card-body text-center">
|
||||
<!-- Success message -->
|
||||
<div class="mb-3">
|
||||
<div class="bg-success text-white rounded-circle d-inline-flex justify-content-center align-items-center"
|
||||
style="width: 80px; height: 80px; font-size: 2.5rem;">
|
||||
✔
|
||||
</div>
|
||||
</div>
|
||||
<h3 class="card-title text-success"><?= __("Yay, it's imported!") ?></h3>
|
||||
<p class="card-text text-muted mb-2"><?= __("The ADIF File has been imported.") ?></p>
|
||||
<p class="card-text">
|
||||
<strong><?= __("Number of QSOs imported:") ?></strong> <?= $qsocount ?>
|
||||
</p>
|
||||
|
||||
<!-- Success message -->
|
||||
<h3 class="card-title"><?= __("Yay, its imported!")?></h3>
|
||||
<p class="card-text"><?= __("The ADIF File has been imported.")?>
|
||||
<!-- Dupe information -->
|
||||
<p class="card-text">
|
||||
<?php if(isset($skip_dupes)): ?>
|
||||
<span class="badge bg-danger"><?= __("Dupes were inserted!") ?></span>
|
||||
<?php else: ?>
|
||||
<span class="badge bg-success"><?= __("Dupes were skipped.") ?></span>
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
|
||||
<!-- Dupe information -->
|
||||
<?php if(isset($skip_dupes)) {
|
||||
echo " <b>" . __("Dupes were inserted!") . "</b>";
|
||||
} else {
|
||||
echo " ".__("Dupes were skipped.");
|
||||
} ?>
|
||||
</p>
|
||||
|
||||
<!-- Display imported information for contest data fixing if contest data was imported -->
|
||||
<!-- Display imported information for contest data fixing if contest data was imported -->
|
||||
<?php if(count($imported_contests) > 0) {?>
|
||||
<div class="alert alert-dark" role="alert">
|
||||
<span class="badge text-bg-info"><?= __("Information"); ?></span> <i class="fas fa-list"></i> <b><?= __("Contest logs imported")?></b>
|
||||
@@ -42,14 +51,19 @@
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<!-- Display errors for ADIF import -->
|
||||
<?php if($adif_errors) { ?>
|
||||
<h3><?= __("Import details / possible problems")?></h3>
|
||||
<p><?= __("You might have ADIF errors, the QSOs have still been added. Please check the following information:")?></p>
|
||||
<p class="card-text"><?php echo $adif_errors; ?></p>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Display errors for ADIF import -->
|
||||
<?php if($adif_errors): ?>
|
||||
<div class="mt-2 ms-2 me-2">
|
||||
<h3 class="text-danger"><?= __("Import details / possible problems") ?></h3>
|
||||
<br> <?= sprintf(__("Check %s for hints about errors in ADIF files."), "<a target=\"_blank\" href=\"https://github.com/wavelog/Wavelog/wiki/ADIF-file-can't-be-imported\">Wavelog Wiki</a>") ?>
|
||||
<p><?= __("You might have ADIF errors, the QSOs have still been added. Please check the following information:") ?></p>
|
||||
|
||||
<div class="border rounded bg-light p-3" style="max-height: 250px; overflow-y: auto;">
|
||||
<pre class="mb-0"><?= $adif_errors ?></pre>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user