[Advanced Logbook] Enhance sat edit and fix sat mode

This commit is contained in:
Andreas Kristiansen
2025-01-14 09:22:08 +01:00
parent 091acb8b36
commit deefb97e39
4 changed files with 50 additions and 7 deletions

View File

@@ -627,9 +627,11 @@ class Logbookadvanced extends CI_Controller {
$column = xss_clean($this->input->post('column'));
$value = xss_clean($this->input->post('value'));
$value2 = xss_clean($this->input->post('value2'));
$value3 = xss_clean($this->input->post('value3'));
$value4 = xss_clean($this->input->post('value4'));
$this->load->model('logbookadvanced_model');
$this->logbookadvanced_model->saveEditedQsos($ids, $column, $value, $value2);
$this->logbookadvanced_model->saveEditedQsos($ids, $column, $value, $value2, $value3, $value4);
$data = $this->logbookadvanced_model->getQsosForAdif($ids, $this->session->userdata('user_id'));

View File

@@ -630,7 +630,7 @@ class Logbookadvanced_model extends CI_Model {
return $this->db->get()->result();
}
function saveEditedQsos($ids, $column, $value, $value2) {
function saveEditedQsos($ids, $column, $value, $value2, $value3, $value4) {
$skipqrzupdate = false;
switch($column) {
case "cqz": $column = 'COL_CQZ'; break;
@@ -763,17 +763,47 @@ class Logbookadvanced_model extends CI_Model {
$query = $this->db->query($sql, array($value, json_decode($ids, true), $this->session->userdata('user_id')));
} else if ($column == 'COL_SAT_NAME') {
$bindings=[];
$propmode = $value == '' ? '' : 'SAT';
$satmode = $value2 ?? '';
$bandtx = $value3 == '' ? '' : $value3;
$bandrx = $value4 == '' ? '' : $value4;
$bindings[] = $value;
$bindings[] = $propmode;
$sql = "UPDATE ".$this->config->item('table_name')." JOIN station_profile ON ". $this->config->item('table_name').".station_id = station_profile.station_id" .
" SET " . $this->config->item('table_name').".COL_SAT_NAME = ?" .
", " . $this->config->item('table_name').".COL_PROP_MODE = ?" .
", " . $this->config->item('table_name').".COL_SAT_MODE = ?" .
" WHERE " . $this->config->item('table_name').".col_primary_key in ? and station_profile.user_id = ?";
", " . $this->config->item('table_name').".COL_PROP_MODE = ?";
$query = $this->db->query($sql, array($value, $propmode, $satmode, json_decode($ids, true), $this->session->userdata('user_id')));
if ($satmode != '') {
$sql .= ", " . $this->config->item('table_name').".COL_SAT_MODE = ?";
$bindings[] = $satmode;
}
if ($bandtx != '') {
$sql .= ", " . $this->config->item('table_name').".COL_BAND = ?";
$bindings[] = $bandtx;
$frequencyBand = $this->frequency->defaultFrequencies[$bandtx]['CW'];
$sql .= ", " . $this->config->item('table_name').".COL_FREQ = ?";
$bindings[] = $frequencyBand;
}
if ($bandrx != '') {
$sql .= ", " . $this->config->item('table_name').".COL_BAND_RX = ?";
$bindings[] = $bandrx;
$frequencyBandRx = $bandrx == '' ? null : $this->frequency->defaultFrequencies[$bandrx]['CW'];
$sql .= ", " . $this->config->item('table_name').".COL_FREQ_RX = ?";
$bindings[] = $frequencyBandRx;
}
$sql .= " WHERE " . $this->config->item('table_name').".col_primary_key in ? and station_profile.user_id = ?";
$bindings[] = json_decode($ids, true);
$bindings[] = $this->session->userdata('user_id');
$query = $this->db->query($sql, $bindings);
} else if ($column == 'COL_LOTW_QSL_SENT') {
$sql = "UPDATE ".$this->config->item('table_name')." JOIN station_profile ON ". $this->config->item('table_name').".station_id = station_profile.station_id" .

View File

@@ -85,6 +85,7 @@
<label style="display:none" id="editSatelliteModeLabel" class="mx-2 w-auto" for="editSatelliteMode"><?= __("SAT Mode"); ?></label>
<input style="display:none" class="form-control form-control-sm w-auto" id="editSatelliteMode" type="text" name="editSatelliteMode" placeholder="" aria-label="editSatelliteMode">
<label style="display:none" id="editBandTxLabel" class="mx-2 w-auto" for="editBand"><?= __("Band TX"); ?></label>
<select style="display:none" id="editBand" class="form-select w-auto form-select-sm" name="editBand">
<?php foreach($bands as $key=>$bandgroup) {
echo '<optgroup label="' . strtoupper($key) . '">';

View File

@@ -177,6 +177,8 @@ function saveBatchEditQsos(id_list) {
if (column == 'satellite') {
value = $("#editSatellite").val();
value2 = $("#editSatelliteMode").val();
value3 = $("#editBand").val();
value4 = $("#editBandRx").val();
}
if (column == 'contest') {
value = $("#editContest").val();
@@ -210,7 +212,9 @@ function saveBatchEditQsos(id_list) {
ids: JSON.stringify(id_list, null, 2),
column: column,
value: value,
value2: value2
value2: value2,
value3: value3,
value4: value4
},
success: function (data) {
if (data != []) {
@@ -234,6 +238,7 @@ function changeEditType(type) {
$('#editTextInput').hide();
$('#editDate').hide();
$('#editBand').hide();
$('#editBandTxLabel').hide();
$('#editMode').hide();
$('#editSatellite').hide();
$('#editSatelliteMode').hide();
@@ -269,6 +274,7 @@ function changeEditType(type) {
$('#editStationLocation').show();
} else if (type == "band") {
$('#editBand').show();
$('#editBandTxLabel').show();
$('#editBandRx').show();
$('#editBandRxLabel').show();
}else if (type == "mode") {
@@ -279,6 +285,10 @@ function changeEditType(type) {
$('#editSatellite').show();
$('#editSatelliteMode').show();
$('#editSatelliteModeLabel').show();
$('#editBand').show();
$('#editBandRx').show();
$('#editBandTxLabel').show();
$('#editBandRxLabel').show();
} else if (type == "contest") {
$('#editContest').show();
} else if (type == "lotwsent" || type == "lotwreceived") {