BUG: add fix for room deletion with attached sub rooms

This commit is contained in:
Ivymaster
2026-05-20 13:18:16 +02:00
parent 363cb90019
commit 48b836c466
2 changed files with 29 additions and 2 deletions
@@ -454,7 +454,7 @@ class Ort extends FHCAPI_Controller
$reservationsCount = hasData($reservationsResult) ? getData($reservationsResult)[0]->count : 0;
if ($reservationsCount > 0) {
$this->terminateWithError("Cannot delete room with shortcode $ort_kurzbz because there are existing reservations for this room", self::ERROR_TYPE_GENERAL);
$this->terminateWithError($this->p->t('ui', 'error_existingReservationsForRoomsUponDeletion'), self::ERROR_TYPE_GENERAL);
}
$softwareImageOrtQuery = "SELECT COUNT(*) FROM extension.tbl_softwareimage_ort WHERE ort_kurzbz = ?";
@@ -465,7 +465,14 @@ class Ort extends FHCAPI_Controller
$softwareImageOrtCount = $softwareImageOrtResult->row()->count;
if ($softwareImageOrtCount > 0) {
$this->terminateWithError($this->p->t('ui', 'error_existingReservationsForRoomsUponDeletion'), self::ERROR_TYPE_GENERAL);
$this->terminateWithError($this->p->t('ui', 'error_existingSoftwareImageForRoomTypeUponDeletion'), self::ERROR_TYPE_GENERAL);
}
$subRoomsCountQuery = "SELECT COUNT(*) FROM public.tbl_ort WHERE parent_ort_kurzbz = ?";
$subRoomsCountQuery = $this->OrtModel->execReadOnlyQuery($subRoomsCountQuery, [$ort_kurzbz]);
$subRoomsCount = hasData($subRoomsCountQuery) ? getData($subRoomsCountQuery)[0]->count : 0;
if ($subRoomsCount > 0) {
$this->terminateWithError($this->p->t('ui', 'error_existingSubRoomsForRoomUponDeletion'), self::ERROR_TYPE_GENERAL);
}
$result = $this->OrtModel->delete([
+20
View File
@@ -58877,6 +58877,26 @@ I have been informed that I am under no obligation to consent to the transmissio
)
)
),
array(
'app' => 'core',
'category' => 'ui',
'phrase' => 'error_existingSubRoomsForRoomUponDeletion',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Es gibt bestehende Unterräume für diesen Raum. Bitte entfernen Sie die Unterräume, bevor Sie den Raum löschen.',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'There are existing sub-rooms for this room. Please remove the sub-rooms before deleting the room.',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'ui',