allow for emptying grid in LBA edit function

This commit is contained in:
phl0
2025-06-27 10:28:17 +02:00
parent 1b92b32340
commit 48a8f6853d

View File

@@ -849,26 +849,30 @@ class Logbookadvanced_model extends CI_Model {
$query = $this->db->query($sql, array($value, $value2, $frequencyBand, $frequencyBandRx, json_decode($ids, true), $this->session->userdata('user_id')));
} else if ($column == 'COL_GRIDSQUARE') {
if(!$this->load->is_loaded('Qra')) {
$this->load->library('Qra');
}
$latlng=$this->qra->qra2latlong(trim(xss_clean($value) ?? ''));
if ($latlng[1] ?? '--' != '--') {
if (strpos(trim(xss_clean($value) ?? ''), ',') !== false) {
$grid_value = null;
$vucc_value = strtoupper(preg_replace('/\s+/', '', xss_clean($value) ?? ''));
} else {
$vucc_value = null;
$grid_value = strtoupper(trim(xss_clean($value) ?? ''));
if ($value == '') {
$grid_value = null;
$vucc_value = null;
} else {
if(!$this->load->is_loaded('Qra')) {
$this->load->library('Qra');
}
$latlng=$this->qra->qra2latlong(trim(xss_clean($value) ?? ''));
if ($latlng[1] ?? '--' != '--') {
if (strpos(trim(xss_clean($value) ?? ''), ',') !== false) {
$grid_value = null;
$vucc_value = strtoupper(preg_replace('/\s+/', '', xss_clean($value) ?? ''));
} else {
$vucc_value = null;
$grid_value = strtoupper(trim(xss_clean($value) ?? ''));
}
}
$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_GRIDSQUARE = ?" .
", " . $this->config->item('table_name').".COL_VUCC_GRIDS = ?" .
" WHERE " . $this->config->item('table_name').".col_primary_key in ? and station_profile.user_id = ?";
$query = $this->db->query($sql, array($grid_value, $vucc_value, json_decode($ids, true), $this->session->userdata('user_id')));
}
$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_GRIDSQUARE = ?" .
", " . $this->config->item('table_name').".COL_VUCC_GRIDS = ?" .
" WHERE " . $this->config->item('table_name').".col_primary_key in ? and station_profile.user_id = ?";
$query = $this->db->query($sql, array($grid_value, $vucc_value, json_decode($ids, true), $this->session->userdata('user_id')));
} else if ($column == 'COL_MODE') {
$this->load->model('logbook_model');