From 5c6b531efd48ba41d0c34726b243f8b14d6ce8e3 Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Sun, 8 Feb 2026 18:32:38 +0100 Subject: [PATCH] [DBTools] Added a location dropdown --- application/controllers/Logbookadvanced.php | 31 +- application/models/Logbookadvanced_model.php | 271 +++++++++++------- .../views/logbookadvanced/dbtoolsdialog.php | 23 +- assets/js/sections/logbookadvanced.js | 188 +++--------- 4 files changed, 250 insertions(+), 263 deletions(-) diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php index 5c0e926be..0e1e34f1d 100644 --- a/application/controllers/Logbookadvanced.php +++ b/application/controllers/Logbookadvanced.php @@ -729,10 +729,6 @@ class Logbookadvanced extends CI_Controller { $this->load->view('logbookadvanced/help'); } - public function continentDialog() { - $this->load->view('logbookadvanced/continentdialog'); - } - public function stateDialog() { $this->load->library('Geojson'); @@ -782,7 +778,9 @@ class Logbookadvanced extends CI_Controller { public function fixContinent() { $this->load->model('logbookadvanced_model'); - $result = $this->logbookadvanced_model->check_missing_continent(); + + $stationid = $this->input->post('stationid', true); + $result = $this->logbookadvanced_model->check_missing_continent($stationid); $data['result'] = $result; @@ -829,8 +827,10 @@ class Logbookadvanced extends CI_Controller { public function updateDistances() { if(!clubaccess_check(9)) return; + $stationid = $this->input->post('stationid', true); + $this->load->model('logbookadvanced_model'); - $result = $this->logbookadvanced_model->update_distances_batch(); + $result = $this->logbookadvanced_model->update_distances_batch($stationid); $data['result'] = $result; @@ -844,16 +844,20 @@ class Logbookadvanced extends CI_Controller { } public function dbtoolsDialog() { - $this->load->view('logbookadvanced/dbtoolsdialog'); + $this->load->model('stations'); + $data['station_profile'] = $this->stations->all_of_user(); + + $this->load->view('logbookadvanced/dbtoolsdialog', $data); } public function checkDb() { if(!clubaccess_check(9)) return; $type = $this->input->post('type', true); + $stationid = $this->input->post('stationid', true); $this->load->model('logbookadvanced_model'); - $data['result'] = $this->logbookadvanced_model->runCheckDb($type); + $data['result'] = $this->logbookadvanced_model->runCheckDb($type, $stationid); if ($type == 'checkstate') { $this->load->view('logbookadvanced/statecheckresult', $data); } else { @@ -870,10 +874,11 @@ class Logbookadvanced extends CI_Controller { $this->load->model('logbookadvanced_model'); $dxcc = $this->input->post('dxcc', true); + $stationid = $this->input->post('stationid', true); $data['country'] = $this->input->post('country', true); // Process for batch QSO state fix - $result = $this->logbookadvanced_model->fixStateBatch($dxcc); + $result = $this->logbookadvanced_model->fixStateBatch($dxcc, $stationid); $data['result'] = $result; @@ -889,19 +894,21 @@ class Logbookadvanced extends CI_Controller { $data['dxcc'] = $this->input->post('dxcc', true); $data['country'] = $this->input->post('country', true); + $data['stationid'] = $this->input->post('stationid', true); // Process for batch QSO state fix - $data['qsos'] = $this->logbookadvanced_model->getStateListQsos($data['dxcc']); + $data['qsos'] = $this->logbookadvanced_model->getStateListQsos($data['dxcc'], $data['stationid']); $this->load->view('logbookadvanced/showStateQsos', $data); } - public function batchFix() { + public function fixMissingGrids() { if(!clubaccess_check(9)) return; $type = $this->input->post('type', true); + $stationid = $this->input->post('stationid', true); $this->load->model('logbookadvanced_model'); - $result = $this->logbookadvanced_model->batchFix($type); + $result = $this->logbookadvanced_model->check_missing_grid($stationid); $data['result'] = $result; $data['type'] = $type; diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php index 41b187ff0..99247a914 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -1608,7 +1608,7 @@ class Logbookadvanced_model extends CI_Model { ]; } - public function check_missing_continent() { + public function check_missing_continent($stationid) { // get all records with no COL_CONT $this->db->trans_start(); $sql = "UPDATE " . $this->config->item('table_name') . " @@ -1619,14 +1619,21 @@ class Logbookadvanced_model extends CI_Model { AND station_profile.user_id = ? AND col_dxcc != 0"; - $query = $this->db->query($sql, array($this->session->userdata('user_id'))); + $bindings[] = $this->session->userdata('user_id'); + + if ($stationid != 'All') { + $sql .= " AND " . $this->config->item('table_name') . ".station_id = ?"; + $bindings[] = $stationid; + } + + $query = $this->db->query($sql, $bindings); $result = $this->db->affected_rows(); $this->db->trans_complete(); return $result; } - public function update_distances_batch() { + public function update_distances_batch($stationid) { ini_set('memory_limit', '-1'); $sql = "SELECT COL_ANT_PATH, COL_DISTANCE, COL_PRIMARY_KEY, station_profile.station_gridsquare, COL_GRIDSQUARE, COL_VUCC_GRIDS FROM " . $this->config->item('table_name') . " @@ -1637,7 +1644,14 @@ class Logbookadvanced_model extends CI_Model { AND (COL_DISTANCE = '' or COL_DISTANCE is NULL) and COL_GRIDSQUARE != station_gridsquare"; - $query = $this->db->query($sql, array($this->session->userdata('user_id'))); + $bindings[] = $this->session->userdata('user_id'); + + if ($stationid != 'All') { + $sql .= " AND " . $this->config->item('table_name') . ".station_id = ?"; + $bindings[] = $stationid; + } + + $query = $this->db->query($sql, $bindings); $recordcount = $query->num_rows(); @@ -1673,26 +1687,26 @@ class Logbookadvanced_model extends CI_Model { return $count; } - public function runCheckDb($type) { + public function runCheckDb($type, $stationid = null) { switch ($type) { case 'checkdistance': - return $this->check_missing_distance(); + return $this->check_missing_distance($stationid); case 'checkcontinent': - return $this->check_qsos_missing_continent(); + return $this->check_qsos_missing_continent($stationid); case 'checkdxcc': - return $this->check_dxcc(); + return $this->check_dxcc($stationid); case 'checkstate': - return $this->check_missing_state(); + return $this->check_missing_state($stationid); case 'checkgrids': - return $this->getMissingGridQsos(); + return $this->getMissingGridQsos($stationid); case 'checkincorrectgridsquares': - return $this->getIncorrectGridsquares(); + return $this->getIncorrectGridsquares($stationid); case 'checkincorrectcqzones': - return $this->getIncorrectCqZones(); + return $this->getIncorrectCqZones($stationid); case 'checkincorrectituzones': - return $this->getIncorrectItuZones(); + return $this->getIncorrectItuZones($stationid); case 'checkiota': - return $this->checkIota(); + return $this->checkIota($stationid); default: return null; } @@ -1701,7 +1715,7 @@ class Logbookadvanced_model extends CI_Model { * Get list of QSOs with gridsquares that do not match the gridsquares listed for the DXCC. * The data comes from the TQSL published Gridsquare list for DXCCs. */ - public function getIncorrectGridsquares() { + public function getIncorrectGridsquares($stationid) { $sqlcheck = "select count(*) as count from vuccgrids";; $querycheck = $this->db->query($sqlcheck); $rowcheck = $querycheck->row(); @@ -1730,59 +1744,83 @@ class Logbookadvanced_model extends CI_Model { and exists (select 1 from vuccgrids where adif = thcv.col_dxcc) and thcv.col_dxcc > 0 and thcv.col_gridsquare is not null - and thcv.col_gridsquare <> '' - order by station_profile_name, col_time_on desc"; + and thcv.col_gridsquare <> ''"; $bindings[] = [$this->session->userdata('user_id')]; + if ($stationid != 'All') { + $sql .= " and thcv.station_id = ?"; + $bindings[] = $stationid; + } + + $sql .= " order by station_profile_name, col_time_on desc"; + $query = $this->db->query($sql, $bindings); return $query->result(); } - public function check_qsos_missing_continent() { - $sql = "select count(*) as count from " . $this->config->item('table_name') . " - join station_profile on " . $this->config->item('table_name') . ".station_id = station_profile.station_id - where user_id = ? - and (coalesce(col_cont, '') = '' or col_cont not in ('AF', 'AN', 'AS', 'EU', 'NA', 'OC', 'SA')) - and col_dxcc != 0"; + public function check_qsos_missing_continent($stationid) { + $sql = "select count(*) as count from " . $this->config->item('table_name') . " thcv + join station_profile on thcv.station_id = station_profile.station_id + where station_profile.user_id = ? + and (coalesce(thcv.col_cont, '') = '' or thcv.col_cont not in ('AF', 'AN', 'AS', 'EU', 'NA', 'OC', 'SA')) + and thcv.col_dxcc != 0"; $bindings[] = [$this->session->userdata('user_id')]; + if ($stationid != 'All') { + $sql .= " and thcv.station_id = ?"; + $bindings[] = $stationid; + } + $query = $this->db->query($sql, $bindings); return $query->result(); } - public function check_missing_distance() { - $sql = "select count(*) as count from " . $this->config->item('table_name') . " - join station_profile on " . $this->config->item('table_name') . ".station_id = station_profile.station_id - where user_id = ? - AND (COL_DISTANCE = '' or COL_DISTANCE is NULL) - and COL_GRIDSQUARE != station_gridsquare - and COL_GRIDSQUARE is NOT NULL - and COL_GRIDSQUARE != ''"; + public function check_missing_distance($stationid) { + $sql = "select count(*) as count from " . $this->config->item('table_name') . " thcv + join station_profile on thcv.station_id = station_profile.station_id + where station_profile.user_id = ? + AND (thcv.COL_DISTANCE = '' or thcv.COL_DISTANCE is NULL) + and thcv.COL_GRIDSQUARE != station_profile.station_gridsquare + and thcv.COL_GRIDSQUARE is NOT NULL + and thcv.COL_GRIDSQUARE != ''"; $bindings[] = [$this->session->userdata('user_id')]; + if ($stationid != 'All') { + $sql .= " and thcv.station_id = ?"; + $bindings[] = $stationid; + } + + $query = $this->db->query($sql, $bindings); return $query->result(); } - public function check_missing_state() { + public function check_missing_state($stationid) { $this->load->library('Geojson'); $supported_dxcc_list = $this->geojson->getSupportedDxccs(); $supported_dxcc_array = array_keys($supported_dxcc_list); - $sql = "select count(*) as count, col_dxcc, dxcc_entities.name as dxcc_name, dxcc_entities.prefix from " . $this->config->item('table_name') . " - join station_profile on " . $this->config->item('table_name') . ".station_id = station_profile.station_id - join dxcc_entities on " . $this->config->item('table_name') . ".col_dxcc = dxcc_entities.adif - where user_id = ? and coalesce(col_state, '') = '' - and col_dxcc in (" . implode(',', array_map('intval', $supported_dxcc_array)) . ") - and length(col_gridsquare) >= 6 - group by col_dxcc, dxcc_entities.name, dxcc_entities.prefix - order by dxcc_entities.prefix"; + $sql = "select count(*) as count, col_dxcc, dxcc_entities.name as dxcc_name, dxcc_entities.prefix from " . $this->config->item('table_name') . " thcv + join station_profile on thcv.station_id = station_profile.station_id + join dxcc_entities on thcv.col_dxcc = dxcc_entities.adif + where station_profile.user_id = ? and coalesce(thcv.col_state, '') = '' + and thcv.col_dxcc in (" . implode(',', array_map('intval', $supported_dxcc_array)) . ") + and length(thcv.col_gridsquare) >= 6"; $bindings[] = [$this->session->userdata('user_id')]; + if ($stationid != 'All') { + $sql .= " and thcv.station_id = ?"; + $bindings[] = $stationid; + } + + $sql .= " group by col_dxcc, dxcc_entities.name, dxcc_entities.prefix + order by dxcc_entities.prefix"; + + $query = $this->db->query($sql, $bindings); return $query->result(); } @@ -1793,7 +1831,7 @@ class Logbookadvanced_model extends CI_Model { * @param int $dxcc DXCC entity number for which to fix states * @return array Result array with success, dxcc_name, dxcc_number, state_code, skipped */ - function fixStateBatch($dxcc) { + function fixStateBatch($dxcc, $stationid) { $this->load->library('Geojson', $dxcc); // Get QSO data @@ -1801,11 +1839,20 @@ class Logbookadvanced_model extends CI_Model { FROM " . $this->config->item('table_name') . " qsos JOIN station_profile ON qsos.station_id = station_profile.station_id LEFT JOIN dxcc_entities d ON qsos.COL_DXCC = d.adif - WHERE qsos.COL_DXCC = ? AND station_profile.user_id = ? + WHERE qsos.COL_DXCC = ? + AND station_profile.user_id = ? AND (qsos.COL_STATE IS NULL OR qsos.COL_STATE = '') AND LENGTH(COALESCE(qsos.COL_GRIDSQUARE, '')) >= 6"; - $query = $this->db->query($sql, [$dxcc, $this->session->userdata('user_id')]); + $bindings[] = $dxcc; + $bindings[] = $this->session->userdata('user_id'); + + if ($stationid != 'All') { + $sql .= " and qsos.station_id = ?"; + $bindings[] = $stationid; + } + + $query = $this->db->query($sql, $bindings); if ($query->num_rows() === 0) { return [ @@ -1888,48 +1935,36 @@ class Logbookadvanced_model extends CI_Model { ]; } - function getStateListQsos($dxcc) { + function getStateListQsos($dxcc, $stationid) { $sql = "SELECT col_primary_key, col_call, col_time_on, col_mode, col_submode, col_band, col_state, col_gridsquare, d.name as dxcc_name, station_profile.station_profile_name FROM " . $this->config->item('table_name') . " qsos JOIN station_profile ON qsos.station_id = station_profile.station_id LEFT JOIN dxcc_entities d ON qsos.COL_DXCC = d.adif WHERE qsos.COL_DXCC = ? AND station_profile.user_id = ? AND (qsos.COL_STATE IS NULL OR qsos.COL_STATE = '') - AND LENGTH(COALESCE(qsos.COL_GRIDSQUARE, '')) >= 6 - ORDER BY COL_TIME_ON DESC"; + AND LENGTH(COALESCE(qsos.COL_GRIDSQUARE, '')) >= 6"; - $query = $this->db->query($sql, [$dxcc, $this->session->userdata('user_id')]); + $bindings[] = $dxcc; + $bindings[] = $this->session->userdata('user_id'); + + if ($stationid != 'All') { + $sql .= " and qsos.station_id = ?"; + $bindings[] = $stationid; + } + + $sql .= " ORDER BY COL_TIME_ON DESC"; + + $query = $this->db->query($sql, $bindings); return $query->result(); } - /* - Function to run batch fixes on the logbook. - Used in dbtools section. - */ - function batchFix($type) { - switch ($type) { - case 'distance': - return $this->update_distances_batch(); - case 'continent': - return $this->check_missing_continent(); - case 'cqzones': - return $this->fixCqZones(); - case 'ituzones': - return $this->fixItuZones(); - case 'grids': - return $this->check_missing_grid(); - default: - return null; - } - } - /* Another function moved from update to the advanced logbook, to be used in the dbtools section. It did not have filter on user or location. This function will check all QSOs with missing grid square and try to fill them using the callbook lookup. */ - public function check_missing_grid() { - $result = $this->getMissingGridQsos(); + public function check_missing_grid($stationid = 'All') { + $result = $this->getMissingGridQsos($stationid); $count = 0; $batch_updates = []; @@ -1972,15 +2007,23 @@ class Logbookadvanced_model extends CI_Model { return $count; } - public function getMissingGridQsos() { + public function getMissingGridQsos($stationid) { $sql = "SELECT col_primary_key, col_call, col_time_on, col_mode, col_submode, col_band, col_state, col_gridsquare, station_profile.station_profile_name FROM " . $this->config->item('table_name') . " qsos JOIN station_profile ON qsos.station_id = station_profile.station_id WHERE station_profile.user_id = ? AND (qsos.COL_GRIDSQUARE IS NULL OR qsos.COL_GRIDSQUARE = '') - AND (qsos.COL_VUCC_GRIDS IS NULL OR qsos.COL_VUCC_GRIDS = '') - ORDER BY COL_TIME_ON DESC limit 150"; + AND (qsos.COL_VUCC_GRIDS IS NULL OR qsos.COL_VUCC_GRIDS = '')"; - $query = $this->db->query($sql, [$this->session->userdata('user_id')]); + $params[] = $this->session->userdata('user_id'); + + if ($stationid != 'All') { + $sql .= " and qsos.station_id = ?"; + $params[] = $stationid; + } + + $sql .= " ORDER BY COL_TIME_ON DESC limit 150"; + + $query = $this->db->query($sql, $params); return $query->result(); } @@ -1988,13 +2031,13 @@ class Logbookadvanced_model extends CI_Model { /* Check all QSOs DXCC against current DXCC database */ - public function check_dxcc() { + public function check_dxcc($stationid) { ini_set('memory_limit', '-1'); $i = 0; $result = array(); - $callarray = $this->getQsos(); + $callarray = $this->getQsos($stationid); // Starting clock time in seconds $start_time = microtime(true); @@ -2040,13 +2083,19 @@ class Logbookadvanced_model extends CI_Model { return $data; } - function getQsos() { + function getQsos($stationid) { $sql = 'select distinct col_country, col_sat_name, col_call, col_dxcc, date(col_time_on) date, col_mode, col_submode, col_band, col_lotw_qsl_rcvd, station_profile.station_profile_name, col_primary_key from ' . $this->config->item('table_name') . ' join station_profile on ' . $this->config->item('table_name') . '.station_id = station_profile.station_id where station_profile.user_id = ?'; + $params[] = $this->session->userdata('user_id'); + if ($stationid != 'All') { + $sql .= " and " . $this->config->item('table_name') . ".station_id = ?"; + $params[] = $stationid; + } + $sql .= ' order by station_profile.station_profile_name asc, date desc'; $query = $this->db->query($sql, $params); @@ -2084,7 +2133,7 @@ class Logbookadvanced_model extends CI_Model { return $result; } - function getIncorrectCqZones() { + function getIncorrectCqZones($stationid) { if(!clubaccess_check(9)) return; $sql = "select *, (select group_concat(distinct cqzone order by cqzone separator ', ') from dxcc_master where countrycode = thcv.col_dxcc and cqzone <> '' order by cqzone asc) as correctcqzone @@ -2096,6 +2145,11 @@ class Logbookadvanced_model extends CI_Model { $params[] = $this->session->userdata('user_id'); + if ($stationid != 'All') { + $sql .= " and thcv.station_id = ?"; + $params[] = $stationid; + } + $sql .= " order by station_profile.station_profile_name, thcv.col_time_on desc limit 5000"; @@ -2104,7 +2158,7 @@ class Logbookadvanced_model extends CI_Model { return $query->result(); } - function getIncorrectItuZones() { + function getIncorrectItuZones($stationid) { if(!clubaccess_check(9)) return; $sql = "select *, (select group_concat(distinct ituzone order by ituzone separator ', ') from dxcc_master where countrycode = thcv.col_dxcc and ituzone <> '' order by ituzone asc) as correctituzone @@ -2116,6 +2170,11 @@ class Logbookadvanced_model extends CI_Model { $params[] = $this->session->userdata('user_id'); + if ($stationid != 'All') { + $sql .= " and thcv.station_id = ?"; + $params[] = $stationid; + } + $sql .= " order by station_profile.station_profile_name, thcv.col_time_on desc limit 5000"; @@ -2124,9 +2183,9 @@ class Logbookadvanced_model extends CI_Model { return $query->result(); } - public function checkIota() { - $result1 = $this->checkSingleIota(); - $result2 = $this->checkMultiDxccIota(); + public function checkIota($stationid) { + $result1 = $this->checkSingleIota($stationid); + $result2 = $this->checkMultiDxccIota($stationid); $merged = array_merge($result1, $result2); @@ -2150,20 +2209,26 @@ class Logbookadvanced_model extends CI_Model { * These are excluded by not having a dxccid or dxccid = 0 * */ - public function checkSingleIota() { + public function checkSingleIota($stationid) { $sql = "select col_primary_key, col_time_on, col_call, col_sat_name, col_band, col_gridsquare, col_dxcc, col_country, station_profile_name, col_lotw_qsl_rcvd, col_mode, col_submode, col_iota, iotadxcc.name as correctdxcc - from " . $this->config->item('table_name') . " thcv - join station_profile on thcv.station_id = station_profile.station_id - join dxcc_entities on dxcc_entities.adif = thcv.COL_DXCC - join iota on thcv.col_iota = iota.tag - join dxcc_entities iotadxcc on iota.dxccid = iotadxcc.adif - where station_profile.user_id = ? - and thcv.col_dxcc > 0 - and thcv.col_dxcc <> iota.dxccid - and iota.dxccid > 0 - order by station_profile_name, col_time_on desc"; + FROM " . $this->config->item('table_name') . " thcv + JOIN station_profile on thcv.station_id = station_profile.station_id + JOIN dxcc_entities on dxcc_entities.adif = thcv.COL_DXCC + JOIN iota on thcv.col_iota = iota.tag + JOIN dxcc_entities iotadxcc on iota.dxccid = iotadxcc.adif + WHERE station_profile.user_id = ? + AND thcv.col_dxcc > 0 + AND thcv.col_dxcc <> iota.dxccid + AND iota.dxccid > 0"; - $bindings[] = [$this->session->userdata('user_id')]; + $bindings[] = $this->session->userdata('user_id'); + + if ($stationid != 'All') { + $sql .= " AND thcv.station_id = ?"; + $bindings[] = $stationid; + } + + $sql .= " order by station_profile_name, col_time_on desc"; $query = $this->db->query($sql, $bindings); return $query->result(); @@ -2173,7 +2238,7 @@ class Logbookadvanced_model extends CI_Model { * Get list of QSOs with multi-DXCC IOTA tags where the DXCC prefix doesn't match * any of the valid prefixes for that IOTA. */ - public function checkMultiDxccIota() { + public function checkMultiDxccIota($stationid) { // Define IOTA tags that span multiple DXCCs with their valid prefixes $multiDxccIotas = [ 'AS-004' => [215, 283], // 5B4, ZC4 @@ -2195,6 +2260,8 @@ class Logbookadvanced_model extends CI_Model { $allResults = []; foreach ($multiDxccIotas as $iotaTag => $adifList) { + $bindings = []; // Reset bindings for each iteration + // Build IN clause for SQL $adifListStr = implode(',', $adifList); @@ -2212,10 +2279,18 @@ class Logbookadvanced_model extends CI_Model { JOIN iota ON thcv.col_iota = iota.tag WHERE station_profile.user_id = ? AND thcv.col_iota = ? - AND dxcc_entities.adif NOT IN ($adifListStr) - ORDER BY station_profile_name, col_time_on DESC"; + AND dxcc_entities.adif NOT IN ($adifListStr)"; + + $bindings[] = $this->session->userdata('user_id'); + $bindings[] = $iotaTag; + + if ($stationid != 'All') { + $sql .= " AND thcv.station_id = ?"; + $bindings[] = $stationid; + } + + $sql .= " ORDER BY station_profile_name, col_time_on DESC"; - $bindings = [$this->session->userdata('user_id'), $iotaTag]; $query = $this->db->query($sql, $bindings); $results = $query->result(); diff --git a/application/views/logbookadvanced/dbtoolsdialog.php b/application/views/logbookadvanced/dbtoolsdialog.php index e796383c5..cca6e55c2 100644 --- a/application/views/logbookadvanced/dbtoolsdialog.php +++ b/application/views/logbookadvanced/dbtoolsdialog.php @@ -5,7 +5,28 @@ -

+

+ + +
+
+
+
+ + +
+
+
+
diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js index 09fd511d0..49f9d65d0 100644 --- a/assets/js/sections/logbookadvanced.js +++ b/assets/js/sections/logbookadvanced.js @@ -1254,72 +1254,6 @@ $(document).ready(function () { }); }); - $('#fixContinent').click(function (event) { - $.ajax({ - url: base_url + 'index.php/logbookadvanced/continentDialog', - type: 'post', - success: function (html) { - BootstrapDialog.show({ - title: lang_gen_advanced_logbook_continent_fix, - size: BootstrapDialog.SIZE_NORMAL, - cssClass: 'options', - nl2br: false, - message: html, - buttons: [ - { - label: lang_gen_advanced_logbook_update_now + '
', - cssClass: 'btn btn-sm btn-primary ld-ext-right', - id: 'updateContinentButton', - action: function (dialogItself) { - runContinentFix(dialogItself); - } - }, - { - label: lang_admin_close, - cssClass: 'btn btn-sm btn-secondary', - id: 'closeButton', - action: function (dialogItself) { - dialogItself.close(); - } - }], - }); - } - }); - }); - - $('#updateDistances').click(function (event) { - $.ajax({ - url: base_url + 'index.php/logbookadvanced/distanceDialog', - type: 'post', - success: function (html) { - BootstrapDialog.show({ - title: lang_gen_advanced_logbook_update_distances, - size: BootstrapDialog.SIZE_NORMAL, - cssClass: 'options', - nl2br: false, - message: html, - buttons: [ - { - label: lang_gen_advanced_logbook_update_now + '
', - cssClass: 'btn btn-sm btn-primary ld-ext-right', - id: 'updateDistanceButton', - action: function (dialogItself) { - runUpdateDistancesFix(dialogItself); - } - }, - { - label: lang_admin_close, - cssClass: 'btn btn-sm btn-secondary', - id: 'closeButton', - action: function (dialogItself) { - dialogItself.close(); - } - }], - }); - } - }); - }); - $('#dbtools').click(function (event) { $.ajax({ url: base_url + 'index.php/logbookadvanced/dbtoolsDialog', @@ -1346,8 +1280,6 @@ $(document).ready(function () { }); }); - - $('#fixItuZones').click(function (event) { const id_list = getSelectedIds(); @@ -2035,7 +1967,8 @@ function saveOptions() { $.ajax({ url: base_url + 'index.php/logbookadvanced/checkDb', data: { - type: 'checkdistance' + type: 'checkdistance', + stationid: $('#dbtools_station_id').val() }, type: 'POST', success: function(response) { @@ -2069,7 +2002,8 @@ function saveOptions() { $.ajax({ url: base_url + 'index.php/logbookadvanced/checkDb', data: { - type: 'checkcontinent' + type: 'checkcontinent', + stationid: $('#dbtools_station_id').val() }, type: 'POST', success: function(response) { @@ -2078,7 +2012,7 @@ function saveOptions() { $('.result').html(response); }, error: function(xhr, status, error) { - $('#checkFixContinentBtn').prop('disabled', false).text(''); + $('#checkFixContinentBtn').prop('disabled', false).removeClass("running"); $('#closeButton').prop('disabled', false); let errorMsg = 'Error checking continent information'; @@ -2102,7 +2036,8 @@ function saveOptions() { $.ajax({ url: base_url + 'index.php/logbookadvanced/checkDb', data: { - type: 'checkstate' + type: 'checkstate', + stationid: $('#dbtools_station_id').val() }, type: 'POST', success: function(response) { @@ -2112,7 +2047,7 @@ function saveOptions() { $('.result').html(response); }, error: function(xhr, status, error) { - $('#checkFixStateBtn').prop('disabled', false).text(''); + $('#checkFixStateBtn').prop('disabled', false).removeClass("running"); $('#closeButton').prop('disabled', false); let errorMsg = 'Error checking state information'; @@ -2129,72 +2064,6 @@ function saveOptions() { }); } - function checkFixCqZones() { - $('#checkFixCqZonesBtn').prop("disabled", true).addClass("running"); - $('#closeButton').prop("disabled", true); - - $.ajax({ - url: base_url + 'index.php/logbookadvanced/checkDb', - data: { - type: 'checkcqzones' - }, - type: 'POST', - success: function(response) { - $('#checkFixCqZonesBtn').prop("disabled", false).removeClass("running"); - $('#closeButton').prop("disabled", false); - $('.result').html(response); - }, - error: function(xhr, status, error) { - $('#checkFixCqZonesBtn').prop('disabled', false).text(''); - $('#closeButton').prop('disabled', false); - - let errorMsg = ''; - if (xhr.responseJSON && xhr.responseJSON.message) { - errorMsg += ': ' + xhr.responseJSON.message; - } - - BootstrapDialog.alert({ - title: 'Error', - message: errorMsg, - type: BootstrapDialog.TYPE_DANGER - }); - } - }); - } - - function checkFixItuZones() { - $('#checkFixItuZonesBtn').prop("disabled", true).addClass("running"); - $('#closeButton').prop("disabled", true); - - $.ajax({ - url: base_url + 'index.php/logbookadvanced/checkDb', - data: { - type: 'checkituzones' - }, - type: 'POST', - success: function(response) { - $('#checkFixItuZonesBtn').prop("disabled", false).removeClass("running"); - $('#closeButton').prop("disabled", false); - $('.result').html(response); - }, - error: function(xhr, status, error) { - $('#checkFixItuZonesBtn').prop('disabled', false).text(''); - $('#closeButton').prop('disabled', false); - - let errorMsg = ''; - if (xhr.responseJSON && xhr.responseJSON.message) { - errorMsg += ': ' + xhr.responseJSON.message; - } - - BootstrapDialog.alert({ - title: 'Error', - message: errorMsg, - type: BootstrapDialog.TYPE_DANGER - }); - } - }); - } - function fixState(dxcc, country) { $('#fixStateBtn_' + dxcc).prop("disabled", true).addClass("running"); @@ -2202,8 +2071,9 @@ function saveOptions() { url: base_url + 'index.php/logbookadvanced/fixStateBatch', type: 'post', data: { - 'dxcc': dxcc, - 'country': country + dxcc: dxcc, + country: country, + stationid: $('#dbtools_station_id').val() }, success: function (response) { $('#fixStateBtn_' + dxcc).prop("disabled", false).removeClass("running"); @@ -2219,11 +2089,12 @@ function saveOptions() { $('#openStateListBtn_' + dxcc).prop("disabled", true).addClass("running"); $.ajax({ - url: base_url + 'index.php/logbookadvanced/OpenStateList', + url: base_url + 'index.php/logbookadvanced/openStateList', type: 'post', data: { - 'dxcc': dxcc, - 'country': country + dxcc: dxcc, + country: country, + stationid: $('#dbtools_station_id').val() }, success: function (response) { $('#openStateListBtn_' + dxcc).prop("disabled", false).removeClass("running"); @@ -2258,6 +2129,9 @@ function saveOptions() { $('#closeButton').prop("disabled", true); $.ajax({ url: base_url + 'index.php/logbookadvanced/updateDistances', + data: { + stationid: $('#dbtools_station_id').val() + }, type: 'POST', success: function (response) { $('#updateDistanceButton').prop("disabled", false).removeClass("running"); @@ -2283,6 +2157,9 @@ function saveOptions() { $('#closeButton').prop("disabled", true); $.ajax({ url: base_url + 'index.php/logbookadvanced/fixContinent', + data: { + stationid: $('#dbtools_station_id').val() + }, type: 'POST', success: function (response) { $('#updateContinentButton').prop("disabled", false).removeClass("running"); @@ -2307,7 +2184,8 @@ function saveOptions() { $.ajax({ url: base_url + 'index.php/logbookadvanced/checkDb', data: { - type: 'checkgrids' + type: 'checkgrids', + stationid: $('#dbtools_station_id').val() }, type: 'POST', success: function(response) { @@ -2328,9 +2206,10 @@ function saveOptions() { $('#updateGridsBtn').prop("disabled", true).addClass("running"); $('#closeButton').prop("disabled", true); $.ajax({ - url: base_url + 'index.php/logbookadvanced/batchFix', + url: base_url + 'index.php/logbookadvanced/fixMissingGrids', data: { - type: 'grids' + type: 'grids', + stationid: $('#dbtools_station_id').val() }, type: 'POST', success: function (response) { @@ -2353,7 +2232,8 @@ function saveOptions() { $.ajax({ url: base_url + 'index.php/logbookadvanced/checkDb', data: { - type: 'checkdxcc' + type: 'checkdxcc', + stationid: $('#dbtools_station_id').val() }, type: 'POST', success: function(response) { @@ -2424,7 +2304,8 @@ function saveOptions() { $.ajax({ url: base_url + 'index.php/logbookadvanced/checkDb', data: { - type: 'checkincorrectcqzones' + type: 'checkincorrectcqzones', + stationid: $('#dbtools_station_id').val() }, type: 'POST', success: function(response) { @@ -2502,7 +2383,8 @@ function saveOptions() { $.ajax({ url: base_url + 'index.php/logbookadvanced/checkDb', data: { - type: 'checkincorrectituzones' + type: 'checkincorrectituzones', + stationid: $('#dbtools_station_id').val() }, type: 'POST', success: function(response) { @@ -2695,7 +2577,8 @@ function saveOptions() { $.ajax({ url: base_url + 'index.php/logbookadvanced/checkDb', data: { - type: 'checkincorrectgridsquares' + type: 'checkincorrectgridsquares', + stationid: $('#dbtools_station_id').val() }, type: 'POST', success: function(response) { @@ -2879,7 +2762,8 @@ function saveOptions() { $.ajax({ url: base_url + 'index.php/logbookadvanced/checkDb', data: { - type: 'checkiota' + type: 'checkiota', + stationid: $('#dbtools_station_id').val() }, type: 'POST', success: function(response) {