diff --git a/Domain/ReservationView.php b/Domain/ReservationView.php index 0cf474854..4bc5ed6ab 100644 --- a/Domain/ReservationView.php +++ b/Domain/ReservationView.php @@ -219,9 +219,12 @@ public function IsCheckinEnabled() public function IsCheckinAvailable() { $checkinMinutes = Configuration::Instance()->GetSectionKey(ConfigSection::RESERVATION, ConfigKeys::RESERVATION_CHECKIN_MINUTES, new IntConverter()); + $checkinAdminOnly = Configuration::Instance()->GetSecionKey(ConfigSection::RESERVATION, ConfigKeys::RESERVATION_CHECKIN_ADMIN_ONLY, new BooleanConverter()); - if ($this->CheckinDate->ToString() == '' && Date::Now()->AddMinutes($checkinMinutes)->GreaterThanOrEqual($this->StartDate)) { - return $this->IsCheckinEnabled(); + if (!($checkinAdminOnly) || $currentUser->IsAdmin) { + if ($this->CheckinDate->ToString() == '' && Date::Now()->AddMinutes($checkinMinutes)->GreaterThanOrEqual($this->StartDate)) { + return $this->IsCheckinEnabled(); + } } return false; @@ -229,6 +232,8 @@ public function IsCheckinAvailable() public function IsCheckoutAvailable() { + //$checkoutAdminOnly = Configuration::Instance()->GetSecionKey(ConfigSection::RESERVATION, ConfigKeys::RESERVATION_CHECKOUT_ADMIN_ONLY, new BooleanConverter()); + if ($this->StartDate->LessThan(Date::Now()) && $this->CheckoutDate->ToString() == '' && $this->CheckinDate->ToString() != '') { diff --git a/config/config.devel.php b/config/config.devel.php index d23ac3eb7..219d1cdee 100644 --- a/config/config.devel.php +++ b/config/config.devel.php @@ -69,6 +69,8 @@ $conf['settings']['reservation']['default.end.reminder'] = ''; // the default end reservation reminder. format is ## interval. for example, 10 minutes, 2 hours, 6 days. $conf['settings']['reservation']['title.required'] = 'false'; $conf['settings']['reservation']['description.required'] = 'false'; +$conf['settings']['reservation']['checkin.admin.only'] = 'true'; + /** * Email notification configuration */ diff --git a/lib/Config/ConfigKeys.php b/lib/Config/ConfigKeys.php index 494885d4d..2fe2f6659 100644 --- a/lib/Config/ConfigKeys.php +++ b/lib/Config/ConfigKeys.php @@ -59,6 +59,7 @@ class ConfigKeys public const RESERVATION_END_REMINDER = 'default.end.reminder'; public const RESERVATION_TITLE_REQUIRED = 'title.required'; public const RESERVATION_DESCRIPTION_REQUIRED = 'description.required'; + public const RESERVATION_CHECKIN_ADMIN_ONLY = 'checkin.admin.only'; public const IMAGE_UPLOAD_DIRECTORY = 'image.upload.directory'; public const IMAGE_UPLOAD_URL = 'image.upload.url';