From f2b8a3eeaa0d38c1af6b3328c082db8a36ffb487 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Sat, 22 Nov 2025 14:38:53 +0000 Subject: [PATCH] Redirect to edit page after logbook creation After creating a new logbook, users are now redirected to the edit page for the newly created logbook instead of the logbooks list. The add method in Logbooks_model now returns the new logbook ID to support this change. --- application/controllers/Logbooks.php | 4 ++-- application/models/Logbooks_model.php | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/application/controllers/Logbooks.php b/application/controllers/Logbooks.php index 1af75f5fc..7f939cb88 100644 --- a/application/controllers/Logbooks.php +++ b/application/controllers/Logbooks.php @@ -43,9 +43,9 @@ class Logbooks extends CI_Controller { else { $this->load->model('logbooks_model'); - $this->logbooks_model->add(); + $new_logbook_id = $this->logbooks_model->add(); - redirect('logbooks'); + redirect('logbooks/edit/' . $new_logbook_id); } } diff --git a/application/models/Logbooks_model.php b/application/models/Logbooks_model.php index 8412a0873..66a30d8e2 100644 --- a/application/models/Logbooks_model.php +++ b/application/models/Logbooks_model.php @@ -52,6 +52,8 @@ class Logbooks_model extends CI_Model { $CI->load->model('user_model'); $CI->user_model->update_session($this->session->userdata('user_id')); } + + return $logbook_id; } function CreateDefaultLogbook() {