make force active a config option
This commit is contained in:
parent
e7ff3b657a
commit
cf570502f4
|
@ -318,6 +318,9 @@ return [
|
|||
// Enables the planned arrival/leave date
|
||||
'enable_planned_arrival' => (bool) env('ENABLE_PLANNED_ARRIVAL', true),
|
||||
|
||||
// Whether force active should be enabled
|
||||
'enable_force_active' => (bool) env('ENABLE_FORCE_ACTIVE', true),
|
||||
|
||||
// Resembles the Goodie Type. There are three options:
|
||||
// 'none' => no goodie at all
|
||||
// 'goodie' => a goodie which has no sizing options
|
||||
|
|
|
@ -238,7 +238,7 @@ function user_controller()
|
|||
auth()->resetApiKey($user_source);
|
||||
}
|
||||
|
||||
if ($user_source->state->force_active) {
|
||||
if ($user_source->state->force_active && config('enable_force_active')) {
|
||||
$tshirt_score = __('Enough');
|
||||
} else {
|
||||
$tshirt_score = sprintf('%.2f', User_tshirt_score($user_source->id)) . ' h';
|
||||
|
|
|
@ -43,7 +43,7 @@ function admin_active()
|
|||
if ($request->has('set_active')) {
|
||||
if ($request->has('count') && preg_match('/^\d+$/', $request->input('count'))) {
|
||||
$count = strip_request_item('count');
|
||||
if ($count < $forced_count) {
|
||||
if ($count < $forced_count && config('enable_force_active')) {
|
||||
error(sprintf(
|
||||
__('At least %s angels are forced to be active. The number has to be greater.'),
|
||||
$forced_count
|
||||
|
@ -85,11 +85,14 @@ function admin_active()
|
|||
->whereNot('users_state.user_info', '');
|
||||
})
|
||||
->groupBy('users.id')
|
||||
->orderByDesc('force_active')
|
||||
->orderByDesc('shift_length')
|
||||
->orderByDesc('name')
|
||||
->limit($count);
|
||||
|
||||
if (config('enable_force_active')) {
|
||||
$query->orderByDesc('force_active');
|
||||
}
|
||||
|
||||
$users = $query->get();
|
||||
$user_nicks = [];
|
||||
foreach ($users as $usr) {
|
||||
|
@ -192,10 +195,13 @@ function admin_active()
|
|||
->whereNot('users_state.user_info', '');
|
||||
})
|
||||
->groupBy('users.id')
|
||||
->orderByDesc('force_active')
|
||||
->orderByDesc('shift_length')
|
||||
->orderByDesc('name');
|
||||
|
||||
if (config('enable_force_active')) {
|
||||
$query->orderByDesc('force_active');
|
||||
}
|
||||
|
||||
if (!is_null($count)) {
|
||||
$query->limit($count);
|
||||
}
|
||||
|
@ -357,8 +363,8 @@ function admin_active()
|
|||
'shift_count' => __('Shifts'),
|
||||
'work_time' => __('Length'),
|
||||
'active' => __('Active?'),
|
||||
'force_active' => __('Forced'),
|
||||
],
|
||||
(config('enable_force_active') ? ['force_active' => __('Forced'),] : []),
|
||||
($goodie_enabled ? ['tshirt' => ($goodie_tshirt ? __('T-shirt?') : __('Goodie?'))] : []),
|
||||
[
|
||||
'actions' => __('general.actions'),
|
||||
|
|
|
@ -140,7 +140,7 @@ function admin_user()
|
|||
}
|
||||
|
||||
// Forced active?
|
||||
if (auth()->can('admin_active')) {
|
||||
if (auth()->can('admin_active') && config('enable_force_active')) {
|
||||
$html .= ' <tr><td>' . __('Force active') . '</td><td>' . "\n";
|
||||
$html .= html_options('force_active', $options, $user_source->state->force_active) . '</td></tr>' . "\n";
|
||||
}
|
||||
|
@ -341,7 +341,7 @@ function admin_user()
|
|||
if ($user_edit_shirt) {
|
||||
$user_source->state->active = $request->postData('eAktiv');
|
||||
}
|
||||
if (auth()->can('admin_active')) {
|
||||
if (auth()->can('admin_active') && config('enable_force_active')) {
|
||||
$user_source->state->force_active = $request->input('force_active');
|
||||
}
|
||||
$user_source->state->save();
|
||||
|
|
|
@ -47,7 +47,7 @@ function User_edit_vouchers_view($user)
|
|||
[
|
||||
msg(),
|
||||
info(sprintf(
|
||||
$user->state->force_active
|
||||
$user->state->force_active && config('enable_force_active')
|
||||
? __('Angel can receive another %d vouchers and is FA.')
|
||||
: __('Angel can receive another %d vouchers.'),
|
||||
User_get_eligable_voucher_count($user)
|
||||
|
@ -157,7 +157,9 @@ function Users_view(
|
|||
}
|
||||
$user_table_headers['freeloads'] = Users_table_header_link('freeloads', __('Freeloads'), $order_by);
|
||||
$user_table_headers['active'] = Users_table_header_link('active', __('user.active'), $order_by);
|
||||
$user_table_headers['force_active'] = Users_table_header_link('force_active', __('Forced'), $order_by);
|
||||
if (config('enable_force_active')) {
|
||||
$user_table_headers['force_active'] = Users_table_header_link('force_active', __('Forced'), $order_by);
|
||||
}
|
||||
if ($goodie_enabled) {
|
||||
if ($goodie_tshirt) {
|
||||
$user_table_headers['got_shirt'] = Users_table_header_link('got_shirt', __('T-Shirt'), $order_by);
|
||||
|
@ -560,7 +562,7 @@ function User_view(
|
|||
'comment' => __('worklog.comment'),
|
||||
'actions' => __('general.actions'),
|
||||
], $my_shifts));
|
||||
} elseif ($user_source->state->force_active) {
|
||||
} elseif ($user_source->state->force_active && config('enable_force_active')) {
|
||||
$myshifts_table = success(
|
||||
($its_me ? __('You have done enough.') : (__('%s has done enough.', [$user_source->name]))),
|
||||
true
|
||||
|
@ -771,7 +773,7 @@ function User_view_state_admin($freeloader, $user_source)
|
|||
)
|
||||
. '</span>';
|
||||
|
||||
if ($user_source->state->force_active) {
|
||||
if ($user_source->state->force_active && config('enable_force_active')) {
|
||||
$state[] = '<span class="text-success">' . __('user.force_active') . '</span>';
|
||||
} elseif ($user_source->state->active) {
|
||||
$state[] = '<span class="text-success">' . __('user.active') . '</span>';
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
'disabled': not has_permission_to('admin_arrive'),
|
||||
}) }}
|
||||
|
||||
{% if userdata.state.force_active %}
|
||||
{% if userdata.state.force_active and config('enable_force_active') %}
|
||||
{{ f.switch('force_active', __('user.force_active'), {
|
||||
'checked': true,
|
||||
'disabled': true,
|
||||
|
|
Loading…
Reference in New Issue