diff options
Diffstat (limited to 'includes/model')
-rw-r--r-- | includes/model/ShiftSignupState.php | 5 | ||||
-rw-r--r-- | includes/model/Shifts_model.php | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/includes/model/ShiftSignupState.php b/includes/model/ShiftSignupState.php index 8d588de3..a2618cf1 100644 --- a/includes/model/ShiftSignupState.php +++ b/includes/model/ShiftSignupState.php @@ -39,6 +39,11 @@ class ShiftSignupState const SHIFT_ENDED = 'SHIFT_ENDED'; /** + * Shift is not available yet + */ + const NOT_YET = 'NOT_YET'; + + /** * User is already signed up */ const SIGNED_UP = 'SIGNED_UP'; diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php index 6f422c32..6bb17cf2 100644 --- a/includes/model/Shifts_model.php +++ b/includes/model/Shifts_model.php @@ -325,6 +325,10 @@ function Shift_signup_allowed_angel( return new ShiftSignupState(ShiftSignupState::NOT_ARRIVED, $free_entries); } + if (config('signup_advance_hours') && $shift['start'] > time() + config('signup_advance_hours') * 3600) { + return new ShiftSignupState(ShiftSignupState::NOT_YET, $free_entries); + } + if (empty($user_shifts)) { $user_shifts = Shifts_by_user($user->id); } |