Fix my_call replacement

This commit is contained in:
Andreas Kristiansen
2025-10-24 16:15:44 +02:00
parent 63814d05d2
commit 9e76830455
4 changed files with 14 additions and 8 deletions

View File

@@ -647,7 +647,9 @@ class QSO extends CI_Controller {
$this->load->model('stations');
$this->load->library('qra');
$stationProfile = $this->input->post('stationProfile', TRUE);
$data = array('station_power' => $this->stations->get_station_power($stationProfile));
$result = $this->stations->get_station_power($stationProfile);
$data['station_power'] = $result['station_power'];
$data['station_callsign'] = $result['station_callsign'];
[$data['lat'], $data['lng']] = $this->qra->qra2latlong($this->stations->gridsquare_from_station($stationProfile));
header('Content-Type: application/json');

View File

@@ -578,15 +578,16 @@ class Stations extends CI_Model {
}
public function get_station_power($id) {
$this->db->select('station_power');
$this->db->select('station_power, station_callsign');
$this->db->where('user_id', $this->session->userdata('user_id'));
$this->db->where('station_id', $id);
$query = $this->db->get('station_profile');
if($query->num_rows() >= 1) {
foreach ($query->result() as $row)
{
return $row->station_power;
}
$row = $query->row(); // only one result expected
return [
'station_power' => $row->station_power,
'station_callsign' => $row->station_callsign
];
} else {
return null;
}

View File

@@ -341,7 +341,7 @@ switch ($date_format) {
$power = '';
foreach ($stations->result() as $stationrow) {
?>
<option value="<?php echo $stationrow->station_id; ?>" <?php if($active_station_profile == $stationrow->station_id) { echo "selected=\"selected\""; $power = $stationrow->station_power; } ?>><?php echo $stationrow->station_profile_name; ?></option>
<option value="<?php echo $stationrow->station_id; ?>" <?php if($active_station_profile == $stationrow->station_id) { echo "selected=\"selected\""; $power = $stationrow->station_power; $station_callsign = $stationrow->station_callsign; } ?>><?php echo $stationrow->station_profile_name; ?></option>
<?php } ?>
</select>
</div>
@@ -832,3 +832,6 @@ switch ($date_format) {
</div>
</div>
<script>
var station_callsign = "<?php echo $station_callsign; ?>";
</script>

View File

@@ -373,7 +373,7 @@ function UpdateMacros(macrotext) {
let newString;
my_call = my_call.replaceAll('Ø', '0');
newString = macrotext.replace(/\[MYCALL\]/g, my_call);
newString = macrotext.replace(/\[MYCALL\]/g, station_callsign);
newString = newString.replace(/\[CALL\]/g, CALL);
newString = newString.replace(/\[RSTS\]/g, RSTS);
return newString;