Add disable activity check option on certain roles #1078 (#1087)

* Add boolean field "disable activity checks" to role, check for this field inside PilotLeave-Check, add tests

* fix checkbox on form

* CS fixes

* CS fixes again :-)

Co-authored-by: Andreas Palm <ap@ewsp.de>
This commit is contained in:
exciler
2021-03-19 18:09:29 +01:00
committed by GitHub
parent 2cede04b1e
commit 9bb192b97f
7 changed files with 117 additions and 3 deletions

View File

@@ -282,9 +282,24 @@ class UserService extends Service
}
// See if the difference is larger than what the setting calls for
if ($date->diffInDays($diff_date) > $leave_days) {
$return_users[] = $user;
if ($date->diffInDays($diff_date) <= $leave_days) {
continue;
}
$skip = false;
// If any role for this user has the "disable_activity_check" feature activated, skip this user
foreach ($user->roles()->get() as $role) {
/** @var Role $role */
if ($role->disable_activity_checks) {
$skip = true;
break;
}
}
if ($skip) {
continue;
}
$return_users[] = $user;
}
return $return_users;