add transactions to student.php

This commit is contained in:
Manuela Thamer
2026-09-04 09:29:42 +02:00
parent 658c8d6bd4
commit dafae33ffb
@@ -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),