Merge pull request #1 from phl0/trimVuccGrids

Trim VUCC_GRIDS Grids
This commit is contained in:
Florian (DF2ET)
2024-01-16 11:13:16 +01:00
committed by GitHub
3 changed files with 7 additions and 7 deletions

View File

@@ -173,7 +173,7 @@ function get_bearing($lat1, $lon1, $lat2, $lon2) {
}
function qra2latlong($strQRA) {
$strQRA=trim($strQRA);
$strQRA=preg_replace('/\s+/', '', $strQRA);
if (substr_count($strQRA, ',') > 0) {
if (substr_count($strQRA, ',') == 3) {
// Handle grid corners

View File

@@ -300,7 +300,7 @@ class Logbook_model extends CI_Model {
// Decide whether its single gridsquare or a multi which makes it vucc_grids
if (strpos(trim(xss_clean($this->input->post('locator')) ?? ''), ',') !== false) {
$data['COL_VUCC_GRIDS'] = strtoupper(trim(xss_clean($this->input->post('locator')) ?? ''));
$data['COL_VUCC_GRIDS'] = strtoupper(preg_replace('/\s+/', '', xss_clean($this->input->post('locator')) ?? ''));
} else {
$data['COL_GRIDSQUARE'] = strtoupper(trim(xss_clean($this->input->post('locator')) ?? ''));
}
@@ -1160,7 +1160,7 @@ class Logbook_model extends CI_Model {
'COL_RST_RCVD' => $this->input->post('rst_rcvd'),
'COL_RST_SENT' => $this->input->post('rst_sent'),
'COL_GRIDSQUARE' => strtoupper(trim($this->input->post('locator'))),
'COL_VUCC_GRIDS' => strtoupper(trim($this->input->post('vucc_grids'))),
'COL_VUCC_GRIDS' => strtoupper(preg_replace('/\s+/', '', $this->input->post('vucc_grids'))),
'COL_DISTANCE' => $this->input->post('distance'),
'COL_COMMENT' => $this->input->post('comment'),
'COL_NAME' => $this->input->post('name'),
@@ -3252,7 +3252,7 @@ function lotw_last_qsl_date($user_id) {
if (isset($record['vucc_grids'])){
$a_grids=explode(',',$record['vucc_grids']); // Split at , if there are junctions
foreach ($a_grids as $singlegrid) {
$singlegrid=strtoupper($singlegrid);
$singlegrid=strtoupper(trim($singlegrid));
if (strlen($singlegrid) == 4) $singlegrid .= "LL"; // Only 4 Chars? Fill with center "LL" as only A-R allowed
if (strlen($singlegrid) == 6) $singlegrid .= "55"; // Only 6 Chars? Fill with center "55"
if (strlen($singlegrid) == 8) $singlegrid .= "LL"; // Only 8 Chars? Fill with center "LL" as only A-R allowed
@@ -3262,7 +3262,7 @@ function lotw_last_qsl_date($user_id) {
if (!preg_match('/^[A-R]{2}[0-9]{2}[A-X]{2}[0-9]{2}[A-X]{2}$/', $singlegrid)) $record['vucc_grids']='';
}
}
$input_vucc_grids = $record['vucc_grids'];
$input_vucc_grids = preg_replace('/\s+/', '', $record['vucc_grids']);
} else {
$input_vucc_grids = NULL;
}

View File

@@ -438,9 +438,9 @@
$distancestring = "(Gridsquare: ".$row->COL_GRIDSQUARE." / distance: ".$distance.")";
} else {
if (substr_count($row->COL_VUCC_GRIDS, ',') == 1) {
$distancestring = "(Gridline: ".$row->COL_VUCC_GRIDS." / distance: ".$distance.")";
$distancestring = "(Gridline: ".preg_replace('/\s+/', '', $row->COL_VUCC_GRIDS)." / distance: ".$distance.")";
} else if (substr_count($row->COL_VUCC_GRIDS, ',') == 3) {
$distancestring = "(Gridcorner: ".$row->COL_VUCC_GRIDS." / distance: ".$distance.")";
$distancestring = "(Gridcorner: ".preg_replace('/\s+/', '', $row->COL_VUCC_GRIDS)." / distance: ".$distance.")";
} else {
$distancestring = "(Grids: ".$row->COL_VUCC_GRIDS.")";
}