Merge pull request #2922 from phl0/trimVuccGrids

Trim VUCC_GRIDS Grids
pull/2932/head
Peter Goodhall 2024-01-15 23:34:06 +00:00 zatwierdzone przez GitHub
commit 369a7c898e
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 7 dodań i 7 usunięć

Wyświetl plik

@ -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

Wyświetl plik

@ -302,7 +302,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')) ?? ''));
}
@ -1167,7 +1167,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'),
@ -3298,7 +3298,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
@ -3308,7 +3308,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;
}

Wyświetl plik

@ -433,9 +433,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.")";
}