From 79b9f9448e4f3ad7abb8d795c1404b3221c95bf9 Mon Sep 17 00:00:00 2001 From: jwacalex Date: Thu, 17 Nov 2016 23:14:39 +0100 Subject: initial commit and functionality for no self sign up --- includes/model/Shifts_model.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'includes/model/Shifts_model.php') diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php index 2db0a3d3..6a29c540 100644 --- a/includes/model/Shifts_model.php +++ b/includes/model/Shifts_model.php @@ -159,14 +159,16 @@ function Shift_signup_allowed($user, $shift, $angeltype, $user_angeltype = null, // you cannot join if shift is full return new ShiftSignupState(ShiftSignupState::OCCUPIED, $free_entries); } - + if ($user_angeltype == null) { $user_angeltype = UserAngelType_by_User_and_AngelType($user, $angeltype); } - if ($user_angeltype == null || ($angeltype['restricted'] == 1 && $user_angeltype != null && ! isset($user_angeltype['confirm_user_id']))) { + if ($user_angeltype == null || ($angeltype['no_self_signup'] == 1 && $user_angeltype != null) || + ($angeltype['restricted'] == 1 && $user_angeltype != null && ! isset($user_angeltype['confirm_user_id']))) { // you cannot join if user is not of this angel type // you cannot join if you are not confirmed + return new ShiftSignupState(ShiftSignupState::ANGELTYPE, $free_entries); } -- cgit v1.2.3-54-g00ecf