From 9e768304550294b35f963a3634f29616bd7bb222 Mon Sep 17 00:00:00 2001
From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com>
Date: Fri, 24 Oct 2025 16:15:44 +0200
Subject: [PATCH] Fix my_call replacement
---
application/controllers/Qso.php | 4 +++-
application/models/Stations.php | 11 ++++++-----
application/views/qso/index.php | 5 ++++-
assets/js/winkey.js | 2 +-
4 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/application/controllers/Qso.php b/application/controllers/Qso.php
index f7c1c2443..e0e7ca8b8 100644
--- a/application/controllers/Qso.php
+++ b/application/controllers/Qso.php
@@ -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');
diff --git a/application/models/Stations.php b/application/models/Stations.php
index 5e22bb106..bc7bf9f19 100644
--- a/application/models/Stations.php
+++ b/application/models/Stations.php
@@ -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;
}
diff --git a/application/views/qso/index.php b/application/views/qso/index.php
index 0fb78d697..53b9562b0 100644
--- a/application/views/qso/index.php
+++ b/application/views/qso/index.php
@@ -341,7 +341,7 @@ switch ($date_format) {
$power = '';
foreach ($stations->result() as $stationrow) {
?>
-
+
@@ -832,3 +832,6 @@ switch ($date_format) {
+
diff --git a/assets/js/winkey.js b/assets/js/winkey.js
index 51d839c3c..c9aecf82c 100644
--- a/assets/js/winkey.js
+++ b/assets/js/winkey.js
@@ -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;