diff --git a/application/controllers/Logbook.php b/application/controllers/Logbook.php index 1903fa630..9f77851bd 100644 --- a/application/controllers/Logbook.php +++ b/application/controllers/Logbook.php @@ -1260,7 +1260,7 @@ class Logbook extends CI_Controller { } /* return station bearing */ - function bearing($locator, $unit = 'M', $station_id = null) { + function bearing($locator, $unit = 'M', $station_id = null, $ant_path = null) { if(!$this->load->is_loaded('Qra')) { $this->load->library('Qra'); } @@ -1284,7 +1284,7 @@ class Logbook extends CI_Controller { $mylocator = $this->config->item('locator'); } - $bearing = $this->qra->bearing($mylocator, $locator, $unit); + $bearing = $this->qra->bearing($mylocator, $locator, $unit, $ant_path); return $bearing; } @@ -1292,7 +1292,7 @@ class Logbook extends CI_Controller { } /* return distance */ - function distance($locator, $station_id = null) { + function distance($locator, $station_id = null, $ant_path = null) { $distance = 0; if(!$this->load->is_loaded('Qra')) { $this->load->library('Qra'); @@ -1317,7 +1317,7 @@ class Logbook extends CI_Controller { $mylocator = $this->config->item('locator'); } - $distance = $this->qra->distance($mylocator, $locator, 'K'); + $distance = $this->qra->distance($mylocator, $locator, 'K', $ant_path); } return $distance; diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php index 75d4570ba..2fcb46c1a 100644 --- a/application/controllers/Logbookadvanced.php +++ b/application/controllers/Logbookadvanced.php @@ -448,8 +448,8 @@ class Logbookadvanced extends CI_Controller { } $this->load->model('logbook_model'); - $data['distance'] = $this->qra->distance($locator1, $locator2, $measurement_base) . $var_dist; - $data['bearing'] = $this->qra->get_bearing($locator1, $locator2) . "º"; + $data['distance'] = $this->qra->distance($locator1, $locator2, $measurement_base, $qso['COL_ANT_PATH']) . $var_dist; + $data['bearing'] = $this->qra->get_bearing($locator1, $locator2, $qso['COL_ANT_PATH']) . "º"; $latlng1 = $this->qra->qra2latlong($locator1); $latlng2 = $this->qra->qra2latlong($locator2); $latlng1[0] = number_format((float)$latlng1[0], 3, '.', '');; diff --git a/application/controllers/Lotw.php b/application/controllers/Lotw.php index ee9a42fbe..982cb9735 100644 --- a/application/controllers/Lotw.php +++ b/application/controllers/Lotw.php @@ -541,6 +541,8 @@ class Lotw extends CI_Controller { } } + $ant_path = $status[3] ?? ''; + if (isset($record['vucc_grids'])) { $qsl_vucc_grids = $record['vucc_grids']; } else { @@ -571,7 +573,7 @@ class Lotw extends CI_Controller { $ituz = ""; } - $lotw_status = $this->logbook_model->lotw_update($time_on, $record['call'], $record['band'], $qsl_date, $record['qsl_rcvd'], $state, $qsl_gridsquare, $qsl_vucc_grids, $iota, $cnty, $cqz, $ituz, $record['station_callsign'],$qso_id4lotw, $station_ids); + $lotw_status = $this->logbook_model->lotw_update($time_on, $record['call'], $record['band'], $qsl_date, $record['qsl_rcvd'], $state, $qsl_gridsquare, $qsl_vucc_grids, $iota, $cnty, $cqz, $ituz, $record['station_callsign'],$qso_id4lotw, $station_ids, $ant_path); $table .= ""; $table .= "".$record['station_callsign'].""; diff --git a/application/libraries/Reg1testformat.php b/application/libraries/Reg1testformat.php index 9e355fb93..3e41c4cdb 100644 --- a/application/libraries/Reg1testformat.php +++ b/application/libraries/Reg1testformat.php @@ -105,7 +105,7 @@ class Reg1testformat { if (!empty($row->COL_GRIDSQUARE)) { if(!array_key_exists($row->COL_GRIDSQUARE, $locators)){ $newlocator = true; - $distance = intval($CI->qra->distance($mylocator, $row->COL_GRIDSQUARE, "K")); + $distance = intval($CI->qra->distance($mylocator, $row->COL_GRIDSQUARE, "K", $row->COL_ANT_PATH)); $locators[$row->COL_GRIDSQUARE] = $distance; }else{ $newlocator = false; diff --git a/application/models/Distances_model.php b/application/models/Distances_model.php index 0f74a5858..38de2915a 100644 --- a/application/models/Distances_model.php +++ b/application/models/Distances_model.php @@ -26,7 +26,7 @@ class Distances_model extends CI_Model if ($station_gridsquare != null) { $gridsquare = explode(',', $station_gridsquare); // We need to convert to an array, since a user can enter several gridsquares - $this->db->select('COL_PRIMARY_KEY,COL_DISTANCE,col_call callsign, col_gridsquare grid'); + $this->db->select('COL_PRIMARY_KEY,COL_DISTANCE,COL_ANT_PATH,col_call callsign, col_gridsquare grid'); $this->db->join('satellite', 'satellite.name = '.$this->config->item('table_name').'.COL_SAT_NAME', 'left outer'); $this->db->where('LENGTH(col_gridsquare) >', 0); @@ -192,8 +192,8 @@ class Distances_model extends CI_Model foreach ($qsoArray as $qso) { $qrb['Qsos']++; // Counts up number of qsos - $bearingdistance = $this->qra->distance($stationgrid, $qso['grid'], $measurement_base); - $bearingdistance_km = $this->qra->distance($stationgrid, $qso['grid'], 'K'); + $bearingdistance = $this->qra->distance($stationgrid, $qso['grid'], $measurement_base, $qso['COL_ANT_PATH']); + $bearingdistance_km = $this->qra->distance($stationgrid, $qso['grid'], 'K', $qso['COL_ANT_PATH']); if ($bearingdistance_km != $qso['COL_DISTANCE']) { $data = array('COL_DISTANCE' => $bearingdistance_km); $this->db->where('COL_PRIMARY_KEY', $qso['COL_PRIMARY_KEY']); diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index cd015549a..c7d8762a4 100644 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -3499,7 +3499,7 @@ class Logbook_model extends CI_Model { $binding = []; $mode = $this->get_main_mode_from_mode($mode); - $sql = 'SELECT COL_PRIMARY_KEY, COL_TIME_ON, COL_CALL, COL_BAND, COL_GRIDSQUARE from ' . $this->config->item('table_name') . ' + $sql = 'SELECT COL_PRIMARY_KEY, COL_TIME_ON, COL_CALL, COL_BAND, COL_GRIDSQUARE, COL_ANT_PATH from ' . $this->config->item('table_name') . ' WHERE COL_TIME_ON >= DATE_ADD(DATE_FORMAT(?, \'%Y-%m-%d %H:%i\' ), INTERVAL -15 MINUTE ) AND COL_TIME_ON <= DATE_ADD(DATE_FORMAT(?, \'%Y-%m-%d %H:%i\' ), INTERVAL 15 MINUTE ) AND COL_CALL=? @@ -3523,9 +3523,9 @@ class Logbook_model extends CI_Model { if ($query->num_rows() > 0) { $ret = $query->row(); - return ["Found", $ret->COL_PRIMARY_KEY, $ret->COL_GRIDSQUARE]; + return ["Found", $ret->COL_PRIMARY_KEY, $ret->COL_GRIDSQUARE, $ret->COL_ANT_PATH]; } else { - return ["No Match", 0, '']; + return ["No Match", 0, '', '']; } } @@ -3570,7 +3570,7 @@ class Logbook_model extends CI_Model { } } - function lotw_update($datetime, $callsign, $band, $qsl_date, $qsl_status, $state, $qsl_gridsquare, $qsl_vucc_grids, $iota, $cnty, $cqz, $ituz, $station_callsign, $qsoid, $station_ids) { + function lotw_update($datetime, $callsign, $band, $qsl_date, $qsl_status, $state, $qsl_gridsquare, $qsl_vucc_grids, $iota, $cnty, $cqz, $ituz, $station_callsign, $qsoid, $station_ids, $ant_path = null) { $data = array( 'COL_LOTW_QSLRDATE' => $qsl_date, @@ -3644,10 +3644,10 @@ class Logbook_model extends CI_Model { } if ($qsl_gridsquare != "") { $data['COL_GRIDSQUARE'] = $qsl_gridsquare; - $data['COL_DISTANCE'] = $this->qra->distance($station_gridsquare, $qsl_gridsquare, 'K'); + $data['COL_DISTANCE'] = $this->qra->distance($station_gridsquare, $qsl_gridsquare, 'K', $ant_path); } elseif ($qsl_vucc_grids != "") { $data['COL_VUCC_GRIDS'] = $qsl_vucc_grids; - $data['COL_DISTANCE'] = $this->qra->distance($station_gridsquare, $qsl_vucc_grids, 'K'); + $data['COL_DISTANCE'] = $this->qra->distance($station_gridsquare, $qsl_vucc_grids, 'K', $ant_path); } $this->db->where('date_format(COL_TIME_ON, \'%Y-%m-%d %H:%i\') = ', $datetime); diff --git a/application/views/view_log/qso.php b/application/views/view_log/qso.php index c233d9588..cafa53a46 100644 --- a/application/views/view_log/qso.php +++ b/application/views/view_log/qso.php @@ -180,7 +180,7 @@ COL_VUCC_GRIDS; ?> qra->distance($row->station_gridsquare, $row->COL_VUCC_GRIDS, $measurement_base); + $distance = $this->qra->distance($row->station_gridsquare, $row->COL_VUCC_GRIDS, $measurement_base, $row->COL_ANT_PATH ?? null); switch ($measurement_base) { case 'M':