Fix adif export

This commit is contained in:
Andreas Kristiansen
2025-11-29 03:57:03 +01:00
parent 7e757c4ab8
commit 208a3022ab
3 changed files with 15 additions and 20 deletions

View File

@@ -154,7 +154,7 @@ class Logbookadvanced extends CI_Controller {
'dok' => xss_clean($this->input->post('dok')),
'qrzSent' => xss_clean($this->input->post('qrzSent')),
'qrzReceived' => xss_clean($this->input->post('qrzReceived')),
'distance' => xss_clean($this->input->post('distance')),
'distance' => xss_clean($this->input->post('distanceinput')),
);
}

View File

@@ -472,14 +472,16 @@ class Logbookadvanced_model extends CI_Model {
$where = "AND $where";
}
$limit = $searchCriteria['qsoresults'];
// Ensure limit has a valid value, default to 250 if empty or invalid
if (empty($limit) || !is_numeric($limit) || $limit <= 0) {
$limit = 250;
$where = trim(implode(" AND ", $conditions));
if ($where != "") {
$where = "AND $where";
}
// Create a version of $where for the inner subquery with proper table alias
$whereInner = str_replace('qsos.', 'qsos_inner.', $where);
$limit = '';
if ($searchCriteria['qsoresults'] != 'All') {
$limit = 'limit ' . $searchCriteria['qsoresults'];
}
$where2 = '';
@@ -494,25 +496,18 @@ class Logbookadvanced_model extends CI_Model {
$sql = "
SELECT qsos.*, dxcc_entities.*, lotw_users.*, station_profile.*, satellite.*, dxcc_entities.name as dxccname, mydxcc.name AS station_country, exists(select 1 from qsl_images where qsoid = qsos.COL_PRIMARY_KEY) as qslcount, coalesce(contest.name, qsos.col_contest_id) as contestname
FROM (
SELECT qsos_inner.COL_PRIMARY_KEY
FROM " . $this->config->item('table_name') . " qsos_inner
INNER JOIN station_profile sp_inner ON qsos_inner.station_id = sp_inner.station_id
WHERE sp_inner.user_id = ?
$whereInner
ORDER BY qsos_inner.COL_TIME_ON desc, qsos_inner.COL_PRIMARY_KEY desc
LIMIT $limit
) AS FilteredIDs
INNER JOIN " . $this->config->item('table_name') . " qsos ON qsos.COL_PRIMARY_KEY = FilteredIDs.COL_PRIMARY_KEY
FROM " . $this->config->item('table_name') . " qsos
INNER JOIN station_profile ON qsos.station_id=station_profile.station_id
LEFT OUTER JOIN satellite ON qsos.col_prop_mode='SAT' and qsos.COL_SAT_NAME = COALESCE(NULLIF(satellite.name, ''), NULLIF(satellite.displayname, ''))
LEFT OUTER JOIN dxcc_entities ON qsos.col_dxcc = dxcc_entities.adif
left outer join dxcc_entities mydxcc on qsos.col_my_dxcc = mydxcc.adif
LEFT OUTER JOIN lotw_users ON qsos.col_call = lotw_users.callsign
LEFT OUTER JOIN contest ON qsos.col_contest_id = contest.adifname
where 1 = 1
WHERE station_profile.user_id = ?
$where
$where2
ORDER BY qsos.COL_TIME_ON desc, qsos.COL_PRIMARY_KEY desc
$limit
";
return $this->db->query($sql, $binding);

View File

@@ -290,11 +290,11 @@ $options = json_decode($options);
<div class="row">
<div <?php if (($options->datetime->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl">
<label class="form-label" for="dateFrom"><?= __("From") . ": " ?></label>
<input name="dateFrom" id="dateFrom" type="date" class="form-control form-control-sm w-auto border border-secondary">
<input name="dateFrom" id="dateFrom" type="date" class="form-control form-control-sm border border-secondary">
</div>
<div <?php if (($options->datetime->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl">
<label class="form-label" for="dateTo"><?= __("To") . ": " ?></label>
<input name="dateTo" id="dateTo" type="date" class="form-control form-control-sm w-auto border border-secondary">
<input name="dateTo" id="dateTo" type="date" class="form-control form-control-sm border border-secondary">
</div>
<div <?php if (($options->dx->show ?? "true") == "false") { echo 'style="display:none"'; } ?> class="mb-3 col-lg-2 col-md-2 col-sm-3 col-xl">
<label class="form-label" for="dx"><?= __("Dx"); ?></label>