diff --git a/application/models/Clublog_model.php b/application/models/Clublog_model.php index 7afb35f18..a87f6af80 100644 --- a/application/models/Clublog_model.php +++ b/application/models/Clublog_model.php @@ -289,7 +289,6 @@ class Clublog_model extends CI_Model function mark_all_qsos_notsent($station_id) { $data = array( 'COL_CLUBLOG_QSO_UPLOAD_DATE' => null, - 'COL_CLUBLOG_QSO_UPLOAD_STATUS' => "M", 'COL_CLUBLOG_QSO_UPLOAD_STATUS' => "N", ); @@ -342,8 +341,22 @@ class Clublog_model extends CI_Model } function disable_sync4call($call, $stations) { - $sql = "update station_profile set clublogignore=1 where station_callsign=? and station_id in (" . $stations . ")"; - $query = $this->db->query($sql, $call); + if (empty($stations) || trim($stations) === '') { + return; + } + + $station_ids = array_filter(explode(",", $stations), function($id) { + return trim($id) !== ''; + }); + + if (empty($station_ids)) { + return; + } + + $placeholders = implode(',', array_fill(0, count($station_ids), '?')); + $sql = "UPDATE station_profile SET clublogignore=1 WHERE station_callsign=? AND station_id IN (" . $placeholders . ")"; + $bindings = array_merge([$call], $station_ids); + $query = $this->db->query($sql, $bindings); } function all_enabled($userid) { diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 5ca31467e..2d3a9f38c 100644 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -4520,7 +4520,18 @@ class Logbook_model extends CI_Model { function clublog_update($datetime, $callsign, $band, $qsl_status, $station_callsign, $station_ids) { - $logbooks_locations_array = explode(",", $station_ids); + if (empty($station_ids) || trim($station_ids) === '') { + return "No station IDs provided"; + } + + $logbooks_locations_array = array_filter(explode(",", $station_ids), function($id) { + return trim($id) !== ''; + }); + + if (empty($logbooks_locations_array)) { + return "No valid station IDs"; + } + $data = array( 'COL_CLUBLOG_QSO_DOWNLOAD_DATE' => date('Y-m-d'), 'COL_CLUBLOG_QSO_DOWNLOAD_STATUS' => $qsl_status,