[Advanced Logbook] Added qrz.com qsl status to batch edit

This commit is contained in:
Andreas Kristiansen
2024-10-14 18:38:05 +02:00
parent 5a95c06be1
commit 7efd6cf6ae
3 changed files with 37 additions and 17 deletions

View File

@@ -597,6 +597,7 @@ class Logbookadvanced_model extends CI_Model {
}
function saveEditedQsos($ids, $column, $value, $value2) {
$skipqrzupdate = false;
switch($column) {
case "cqz": $column = 'COL_CQZ'; break;
case "ituz": $column = 'COL_ITUZ'; break;
@@ -621,6 +622,8 @@ class Logbookadvanced_model extends CI_Model {
case "lotwreceived": $column = 'COL_LOTW_QSL_RCVD'; break;
case "qslmsg": $column = 'COL_QSLMSG'; break;
case "continent": $column = 'COL_CONT'; break;
case "qrzsent": $column = 'COL_QRZCOM_QSO_UPLOAD_STATUS'; break;
case "qrzreceived": $column = 'COL_QRZCOM_QSO_DOWNLOAD_STATUS'; break;
default: return;
}
@@ -747,6 +750,23 @@ 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_QRZCOM_QSO_UPLOAD_STATUS') {
$skipqrzupdate = true;
$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_QRZCOM_QSO_UPLOAD_STATUS = ?, " . $this->config->item('table_name').".COL_QRZCOM_QSO_UPLOAD_DATE = now()" .
" WHERE " . $this->config->item('table_name').".col_primary_key in ? and station_profile.user_id = ?";
$query = $this->db->query($sql, array($value, json_decode($ids, true), $this->session->userdata('user_id')));
} else if ($column == 'COL_QRZCOM_QSO_DOWNLOAD_STATUS') {
$skipqrzupdate = true;
$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_QRZCOM_QSO_DOWNLOAD_STATUS = ?, " . $this->config->item('table_name').".COL_QRZCOM_QSO_DOWNLOAD_DATE = now()" .
" WHERE " . $this->config->item('table_name').".col_primary_key in ? and station_profile.user_id = ?";
$query = $this->db->query($sql, array($value, json_decode($ids, true), $this->session->userdata('user_id')));
} else if ($column == 'COL_QSLMSG') {
$sql = "UPDATE ".$this->config->item('table_name')." JOIN station_profile ON ". $this->config->item('table_name').".station_id = station_profile.station_id" .
@@ -768,23 +788,9 @@ class Logbookadvanced_model extends CI_Model {
$query = $this->db->query($sql, array($value, json_decode($ids, true), $this->session->userdata('user_id')));
}
//Also set QRZ.com status to modified
if (!$this->load->is_loaded('logbook_model')) {
$this->load->model('logbook_model');
}
$modifiedQsos=[];
foreach (json_decode($ids, true) as $id) {
$qso = $this->logbook_model->get_qso($id)->row();
if ($qso->COL_QRZCOM_QSO_UPLOAD_STATUS == 'Y') {
log_message('info', '[LBA] Updating QRZ.com status for QSO ID: ' . $id . ' to M');
$modifiedQsos[] = $id;
}
}
if (!empty($modifiedQsos)) {
$qso_ids = implode(',', $modifiedQsos);
$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_QRZCOM_QSO_UPLOAD_STATUS = 'M' WHERE " . $this->config->item('table_name').".col_primary_key in (".$qso_ids.") and station_profile.user_id = ?";
$query = $this->db->query($sql, $this->session->userdata('user_id'));
if (!$skipqrzupdate) {
$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_QRZCOM_QSO_UPLOAD_STATUS = 'M' WHERE " . $this->config->item('table_name').".col_primary_key in ? and station_profile.user_id = ? and col_qrzcom_qso_upload_status = 'Y'";
$query = $this->db->query($sql, array(json_decode($ids, true), $this->session->userdata('user_id')));
}
$this->db->trans_complete();

View File

@@ -23,6 +23,8 @@
<option value="lotwsent"><?= __("LoTW Sent"); ?></option>
<option value="lotwreceived"><?= __("LoTW Received"); ?></option>
<option value="continent"><?= __("Continent"); ?></option>
<option value="qrzsent"><?= __("QRZ Sent"); ?></option>
<option value="qrzreceived"><?= __("QRZ Received"); ?></option>
</select>
<div>&nbsp;</div>
@@ -138,6 +140,12 @@
<option value="V">Verified</option>
</select>
<select style="display:none" class="form-select w-auto form-select-sm w-auto" id="editQrz" name="qrz">
<option value="Y">Yes</option>
<option value="N">No</option>
<option value="I">Invalid</option>
</select>
<select style="display:none" id="editContinent" name="continent" class="form-select w-auto form-select-sm w-auto">
<option value=""><?= __("None/Empty"); ?></option>
<option value="AF"><?= __("Africa"); ?></option>

View File

@@ -183,6 +183,9 @@ function saveBatchEditQsos(id_list) {
if (column == 'lotwsent' || column == 'lotwreceived') {
value = $("#editLoTW").val();
}
if (column == 'qrzsent' || column == 'qrzreceived') {
value = $("#editQrz").val();
}
if (column == 'continent') {
value = $("#editContinent").val();
}
@@ -233,6 +236,7 @@ function changeEditType(type) {
$('#editContest').hide();
$('#editLoTW').hide();
$('#editContinent').hide();
$('#editQrz').hide();
editDxccStateListLabel
if (type == "dxcc") {
$('#editDxcc').show();
@@ -266,6 +270,8 @@ function changeEditType(type) {
$('#editContest').show();
} else if (type == "lotwsent" || type == "lotwreceived") {
$('#editLoTW').show();
} else if (type == "qrzsent" || type == "qrzreceived") {
$('#editQrz').show();
} else if (type == "continent") {
$('#editContinent').show();
} else if (type == "gridsquare" || type == "sota" || type == "wwff" || type == "operator" || type == "pota" || type == "comment" || type == "qslvia" || type == "contest" || type == "qslmsg") {