diff --git a/includes/controller/shift_entries_controller.php b/includes/controller/shift_entries_controller.php index a63e95cc..29ca88e7 100644 --- a/includes/controller/shift_entries_controller.php +++ b/includes/controller/shift_entries_controller.php @@ -151,24 +151,6 @@ function shift_entry_create_controller_supporter($shift, $angeltype) throw_redirect(shift_link($shift)); } - $needed_angeltype = NeededAngeltype_by_Shift_and_Angeltype($shift, $angeltype); - $shift_entries = ShiftEntries_by_shift_and_angeltype($shift['SID'], $angeltype['id']); - $shift_signup_state = Shift_signup_allowed( - $signup_user, - $shift, - $angeltype, - null, - null, - $needed_angeltype, - $shift_entries - ); - if (!$shift_signup_state->isSignupAllowed()) { - if ($shift_signup_state->getState() == ShiftSignupState::OCCUPIED) { - error(__('This shift is already occupied.')); - } - throw_redirect(shift_link($shift)); - } - if ($request->hasPostData('submit')) { ShiftEntry_create([ 'SID' => $shift['SID'], diff --git a/includes/view/Shifts_view.php b/includes/view/Shifts_view.php index 2b365511..a21a74a0 100644 --- a/includes/view/Shifts_view.php +++ b/includes/view/Shifts_view.php @@ -82,7 +82,13 @@ function Shift_signup_button_render($shift, $angeltype, $user_angeltype = null) $user_angeltype = UserAngelType_by_User_and_AngelType(auth()->user()->id, $angeltype); } - if (isset($angeltype['shift_signup_state']) && $angeltype['shift_signup_state']->isSignupAllowed()) { + if ( + isset($angeltype['shift_signup_state']) + && ( + $angeltype['shift_signup_state']->isSignupAllowed() + || User_is_AngelType_supporter(auth()->user(), $angeltype) + ) + ) { return button(shift_entry_create_link($shift, $angeltype), __('Sign up')); } elseif (empty($user_angeltype)) { return button(