From 81e8b5172903c298ddf3ced0e8209b952acc703d Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Tue, 3 Dec 2019 19:16:40 +0000 Subject: [PATCH] Deleting a station profile also deletes all its associated QSOs --- application/models/Stations.php | 5 +++++ application/views/station_profile/index.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/application/models/Stations.php b/application/models/Stations.php index b7accea8..46eddd10 100644 --- a/application/models/Stations.php +++ b/application/models/Stations.php @@ -73,6 +73,11 @@ class Stations extends CI_Model { // Clean ID $clean_id = $this->security->xss_clean($id); + // Delete QSOs + $this->db->where('station_id', $id); + $this->db->delete($this->config->item('table_name')); + + // Delete Station Profile $this->db->delete('station_profile', array('station_id' => $clean_id)); } diff --git a/application/views/station_profile/index.php b/application/views/station_profile/index.php index 8533db7a..15e9ef69 100644 --- a/application/views/station_profile/index.php +++ b/application/views/station_profile/index.php @@ -70,7 +70,7 @@ station_id; ?>" class="btn btn-info btn-sm"> Edit - station_id; ?>" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want delete QSO station_profile_name; ?>?');"> Delete + station_id; ?>" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want delete station profile station_profile_name; ?> this will delete all QSOs within this station profile?');"> Delete