From dafae33ffbe62d211bb90ff7705560bf856dfa8a Mon Sep 17 00:00:00 2001 From: Manuela Thamer Date: Fri, 4 Sep 2026 09:29:42 +0200 Subject: [PATCH] add transactions to student.php --- .../controllers/api/frontend/v1/stv/Student.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/application/controllers/api/frontend/v1/stv/Student.php b/application/controllers/api/frontend/v1/stv/Student.php index 943df7b91..b1fe243c9 100644 --- a/application/controllers/api/frontend/v1/stv/Student.php +++ b/application/controllers/api/frontend/v1/stv/Student.php @@ -345,6 +345,10 @@ class Student extends FHCAPI_Controller } // Do Updates + + // use transactions + $this->db->trans_begin(); + if (count($update_lehrverband)) { $curstudlvb = $this->StudentlehrverbandModel->load([ @@ -436,6 +440,18 @@ class Student extends FHCAPI_Controller $this->getDataOrTerminateWithError($result); } + if ($this->db->trans_status() === FALSE) + { + $this->db->trans_rollback(); + + $this->terminateWithError( + $this->p->t('ui', 'error_save'), + self::ERROR_TYPE_GENERAL + ); + } + + $this->db->trans_commit(); + $this->terminateWithSuccess(array_fill_keys(array_merge( array_keys($update_lehrverband), array_keys($update_person),