diff --git a/application/config/navigation.php b/application/config/navigation.php index 31ac08766..55a97e7f9 100644 --- a/application/config/navigation.php +++ b/application/config/navigation.php @@ -45,6 +45,14 @@ $config['navigation_header'] = array( 'expand' => true, 'sort' => 30, 'requiredPermissions' => 'admin:w' + ), + 'roomManagerOverview' => array( + 'link' => site_url('RoomManager'), + 'icon' => '', + 'description' => 'Raumverwaltung', + 'expand' => true, + 'sort' => 40, + 'requiredPermissions' => 'admin:w' ) ) ), diff --git a/application/controllers/RoomManager.php b/application/controllers/RoomManager.php index 9591f5f36..2221709eb 100644 --- a/application/controllers/RoomManager.php +++ b/application/controllers/RoomManager.php @@ -15,7 +15,7 @@ class RoomManager extends Auth_Controller { parent::__construct( array( - 'index' => array('lehre/unterrichtszeiten_gk:r'), + 'index' => array('basis/ort:r') ) ); @@ -42,7 +42,11 @@ class RoomManager extends Auth_Controller // Public methods public function index() { - return $this->load->view('room_manager/index'); + return $this->load->view('room_manager/index', [ + 'permissions' => [ + 'basis/ort_w' => $this->permissionlib->isBerechtigt('basis/ort', 'suid'), + ], + ]); } // ----------------------------------------------------------------------------------------------------------------- diff --git a/application/controllers/api/frontend/v1/Ort.php b/application/controllers/api/frontend/v1/Ort.php index aecebfb6d..c43ad8cdf 100644 --- a/application/controllers/api/frontend/v1/Ort.php +++ b/application/controllers/api/frontend/v1/Ort.php @@ -32,15 +32,15 @@ class Ort extends FHCAPI_Controller public function __construct() { parent::__construct([ - 'getAllRooms' => self::PERM_LOGGED, + 'getAllRooms' => array('basis/ort:r'), 'getRooms' => self::PERM_LOGGED, 'getTypes' => self::PERM_LOGGED, 'ContentID' => self::PERM_LOGGED, 'getOrtKurzbzContent' => self::PERM_LOGGED, 'getRoom' => self::PERM_LOGGED, - 'createRoom' => self::PERM_LOGGED, - 'updateRoom' => self::PERM_LOGGED, - 'deleteRoom' => self::PERM_LOGGED, + 'createRoom' => array('basis/ort:rw'), + 'updateRoom' => array('basis/ort:rw'), + 'deleteRoom' => array('basis/ort:rw'), ]); $this->load->library('form_validation'); @@ -82,16 +82,16 @@ class Ort extends FHCAPI_Controller $queryWhereFragments = []; - $searchableIdAttributes = ['standort_id', 'oe_kurzbz', 'gebteil']; - $searchableTextAttributes = ['ort_kurzbz', 'bezeichnung', 'planbezeichnung', 'oe_kurzbz', 'oe_bezeichnung']; + $searchableIdAttributes = ['standort_id', 'gebteil']; + $searchableTextAttributes = ['ort_kurzbz', 'parent_ort_kurzbz', 'bezeichnung', 'planbezeichnung', 'oe_kurzbz', 'oe_bezeichnung']; $searchableBooleanAttributes = ['lehre', 'reservieren', 'aktiv']; - $searchableNumericAttributes = ['max_person', 'arbeitsplaetze']; + $searchableNumericAttributes = ['max_person', 'arbeitsplaetze', 'kosten', 'stockwerk']; $searchableNumericSpanAttributes = ['m2']; foreach ($searchableIdAttributes as $attribute) { if (isset($filter[$attribute]) && $filter[$attribute] !== '') { $queryWhereFragments[] = "public.tbl_ort.$attribute = ?"; - $filterData[] = $filter[$attribute]; + $filterData[] = trim($filter[$attribute]); } } @@ -102,7 +102,7 @@ class Ort extends FHCAPI_Controller } if (isset($filter[$attribute]) && $filter[$attribute] !== '') { $queryWhereFragments[] = "$tableAttribute ILIKE ?"; - $filterData[] = '%' . $filter[$attribute] . '%'; + $filterData[] = '%' . trim($filter[$attribute]) . '%'; } } @@ -116,15 +116,15 @@ class Ort extends FHCAPI_Controller foreach ($searchableNumericAttributes as $attribute) { if (isset($filter[$attribute]) && $filter[$attribute] !== '') { $queryWhereFragments[] = "public.tbl_ort.$attribute = ?"; - $filterData[] = $filter[$attribute]; + $filterData[] = trim($filter[$attribute]); } } foreach ($searchableNumericSpanAttributes as $attribute) { if (isset($filter[$attribute]) && $filter[$attribute] !== '') { $queryWhereFragments[] = "public.tbl_ort.$attribute >= ? AND public.tbl_ort.$attribute <= ?"; - $filterData[] = $filter[$attribute] - 1; - $filterData[] = $filter[$attribute] + 1; + $filterData[] = trim($filter[$attribute]) - 1; + $filterData[] = trim($filter[$attribute]) + 1; } } diff --git a/application/controllers/api/frontend/v1/RoomToRoomTypeApi.php b/application/controllers/api/frontend/v1/RoomToRoomTypeApi.php index 0cf4afcb9..dce9e4b37 100644 --- a/application/controllers/api/frontend/v1/RoomToRoomTypeApi.php +++ b/application/controllers/api/frontend/v1/RoomToRoomTypeApi.php @@ -33,9 +33,9 @@ class RoomToRoomTypeApi extends FHCAPI_Controller { // NOTE(chris): additional permission checks will be done in SearchBarLib parent::__construct([ - 'getRoomToRoomTypeRelationsByRoomShortCode' => self::PERM_LOGGED, - 'createRoomToRoomTypeRelation' => self::PERM_LOGGED, - 'deleteRoomToRoomTypeRelation' => self::PERM_LOGGED, + 'getRoomToRoomTypeRelationsByRoomShortCode' => array('basis/ort:r'), + 'createRoomToRoomTypeRelation' => array('basis/ort:rw'), + 'deleteRoomToRoomTypeRelation' => array('basis/ort:rw'), ]); $this->load->library('form_validation'); @@ -101,6 +101,7 @@ class RoomToRoomTypeApi extends FHCAPI_Controller public function deleteRoomToRoomTypeRelation() { $this->form_validation->set_rules('roomShortCode', 'roomShortCode', 'required'); $this->form_validation->set_rules('roomTypeShortCode', 'roomTypeShortCode', 'required'); + $this->form_validation->set_rules('hierarchy', 'hierarchy', 'required|integer'); if ($this->form_validation->run() === false) { return $this->terminateWithError(validation_errors()); @@ -109,6 +110,7 @@ class RoomToRoomTypeApi extends FHCAPI_Controller $result = $this->OrtRoomTypeModel->db->delete($this->OrtRoomTypeModel->getDbTable(), [ 'ort_kurzbz' => $this->input->post('roomShortCode'), 'raumtyp_kurzbz' => $this->input->post('roomTypeShortCode'), + 'hierarchie' => $this->input->post('hierarchy'), ]); if ($result === false) { diff --git a/application/controllers/api/frontend/v1/RoomTypeApi.php b/application/controllers/api/frontend/v1/RoomTypeApi.php index d1dcda770..d8ded8500 100644 --- a/application/controllers/api/frontend/v1/RoomTypeApi.php +++ b/application/controllers/api/frontend/v1/RoomTypeApi.php @@ -32,8 +32,8 @@ class RoomTypeApi extends FHCAPI_Controller public function __construct() { parent::__construct([ - 'getAllRoomTypes' => self::PERM_LOGGED, - 'createRoomType' => self::PERM_LOGGED, + 'getAllRoomTypes' => array('basis/ort:r'), + 'createRoomType' => array('basis/ort:rw'), ]); $this->load->library('form_validation'); diff --git a/application/views/room_manager/index.php b/application/views/room_manager/index.php index 0b39d760d..c5c26c55a 100644 --- a/application/views/room_manager/index.php +++ b/application/views/room_manager/index.php @@ -32,7 +32,8 @@ $this->load->view('templates/FHC-Header', $includesArray);
{{$capitalize($p.t('ui', 'assignRoomTypeToRoomModalTitle'))}}
-{{$capitalize($p.t('ui', 'createRoomTypeFormTitle'))}}
+{{$capitalize($p.t('ui', 'createRoomTypeFormTitle'))}}
+{{$capitalize($p.t('ui', 'assignedRoomTypesTitle'))}}
diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index b04e86eb4..2bd8eaf7a 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -58897,6 +58897,86 @@ I have been informed that I am under no obligation to consent to the transmissio ) ) ), + array( + 'app' => 'core', + 'category' => 'ui', + 'phrase' => 'btn_editRoomType', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Raumtyp bearbeiten', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Edit room type', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'ui', + 'phrase' => 'btn_editRoomType', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Raumtyp bearbeiten', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Edit room type', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'ui', + 'phrase' => 'btn_deleteRoomToRoomTypeRelation', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Raumtyp zuweisung löschen', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Delete room type assignment', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), + array( + 'app' => 'core', + 'category' => 'ui', + 'phrase' => 'deleteRoomToRoomTypeRelationConfirmation', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Sind Sie sicher, dass Sie diese Raumtyp Zuweisung löschen möchten?', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Are you sure you want to delete this room type assignment?', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), );