Merge pull request #2661 from AndreasK79/lba_db_tools

Database tools in the Advanced Logbook
This commit is contained in:
Andreas Kristiansen
2025-12-19 08:33:47 +01:00
committed by GitHub
14 changed files with 1533 additions and 242 deletions

View File

@@ -785,7 +785,6 @@ class Logbookadvanced extends CI_Controller {
header("Content-Type: application/json");
print json_encode($q);
}
public function fixItuZones() {
@@ -834,8 +833,11 @@ class Logbookadvanced extends CI_Controller {
$this->load->model('logbookadvanced_model');
$result = $this->logbookadvanced_model->check_missing_continent();
header("Content-Type: application/json");
print json_encode($result);
$data['result'] = $result;
$data['type'] = 'continent';
$this->load->view('logbookadvanced/showUpdateResult', $data);
}
public function fixStateProgress() {
@@ -874,14 +876,110 @@ class Logbookadvanced extends CI_Controller {
}
public function updateDistances() {
if(!clubaccess_check(9)) return;
$this->load->model('logbookadvanced_model');
$result = $this->logbookadvanced_model->update_distances_batch();
header("Content-Type: application/json");
print json_encode($result);
$data['result'] = $result;
$data['type'] = 'distance';
$this->load->view('logbookadvanced/showUpdateResult', $data);
}
public function callbookDialog() {
$this->load->view('logbookadvanced/callbookdialog');
}
public function dbtoolsDialog() {
$this->load->view('logbookadvanced/dbtoolsdialog');
}
public function checkDb() {
if(!clubaccess_check(9)) return;
$type = $this->input->post('type', true);
$this->load->model('logbookadvanced_model');
$data['result'] = $this->logbookadvanced_model->runCheckDb($type);
if ($type == 'checkstate') {
$this->load->view('logbookadvanced/statecheckresult', $data);
} else {
$data['type'] = $type;
$this->load->view('logbookadvanced/checkresult', $data);
}
}
public function fixStateBatch() {
if(!clubaccess_check(9)) return;
$this->load->model('logbook_model');
$this->load->model('logbookadvanced_model');
$dxcc = $this->input->post('dxcc', true);
$data['country'] = $this->input->post('country', true);
// Process for batch QSO state fix
$result = $this->logbookadvanced_model->fixStateBatch($dxcc);
$data['result'] = $result;
$data['type'] = 'state';
$this->load->view('logbookadvanced/showUpdateResult', $data);
}
public function openStateList() {
if(!clubaccess_check(9)) return;
$this->load->model('logbookadvanced_model');
$data['dxcc'] = $this->input->post('dxcc', true);
$data['country'] = $this->input->post('country', true);
// Process for batch QSO state fix
$data['qsos'] = $this->logbookadvanced_model->getStateListQsos($data['dxcc']);
$this->load->view('logbookadvanced/showStateQsos', $data);
}
public function fixMissingDxcc() {
if(!clubaccess_check(9)) return;
$all = $this->input->post('all', true);
$this->load->model('logbookadvanced_model');
$result = $this->logbookadvanced_model->check_missing_dxcc_id($all);
$data['result'] = $result;
$data['all'] = $all;
$data['type'] = 'dxcc';
$this->load->view('logbookadvanced/showUpdateResult', $data);
}
public function openMissingDxccList() {
if(!clubaccess_check(9)) return;
$this->load->model('logbookadvanced_model');
$data['qsos'] = $this->logbookadvanced_model->getMissingDxccQsos();
$this->load->view('logbookadvanced/showMissingDxccQsos', $data);
}
public function batchFix() {
if(!clubaccess_check(9)) return;
$type = $this->input->post('type', true);
$this->load->model('logbookadvanced_model');
$result = $this->logbookadvanced_model->batchFix($type);
$data['result'] = $result;
$data['type'] = $type;
$this->load->view('logbookadvanced/showUpdateResult', $data);
}
}

View File

@@ -327,17 +327,6 @@ class Update extends CI_Controller {
}
}
public function check_missing_dxcc($all = false){
$this->load->model('user_model');
if (!$this->user_model->authorize(99)) {
$this->session->set_flashdata('error', __("You're not allowed to do that!"));
redirect('dashboard');
}
$this->load->model('logbook_model');
$this->logbook_model->check_missing_dxcc_id($all);
}
public function update_clublog_scp() {
$lockfilename='/tmp/.update_clublog_scp_running';
if (!file_exists($lockfilename)) {