diff --git a/includes/controller/angeltypes_controller.php b/includes/controller/angeltypes_controller.php index a4798ad6..2bb95d53 100644 --- a/includes/controller/angeltypes_controller.php +++ b/includes/controller/angeltypes_controller.php @@ -148,7 +148,7 @@ function angeltype_edit_controller() $angeltype->description = strip_request_item_nl('description', $angeltype->description); $angeltype->contact_name = strip_request_item('contact_name', $angeltype->contact_name); - $angeltype->contact_dect = strip_request_item('contact_dect', $angeltype->contact_dect); + $angeltype->contact_dect = strip_request_item('contact_dect', $angeltype->contact_dect) ?: ''; $angeltype->contact_email = strip_request_item('contact_email', $angeltype->contact_email); if ($valid) { diff --git a/includes/view/AngelTypes_view.php b/includes/view/AngelTypes_view.php index 96eb2481..63947286 100644 --- a/includes/view/AngelTypes_view.php +++ b/includes/view/AngelTypes_view.php @@ -126,7 +126,7 @@ function AngelType_edit_view(AngelType $angeltype, bool $supporter_mode) __('Primary contact person/desk for user questions.') ), form_text('contact_name', __('Name'), $angeltype->contact_name), - form_text('contact_dect', __('DECT'), $angeltype->contact_dect), + config('enable_dect') ? form_text('contact_dect', __('DECT'), $angeltype->contact_dect) : '', form_text('contact_email', __('E-Mail'), $angeltype->contact_email), form_submit('submit', __('Save')) ]) @@ -220,7 +220,9 @@ function AngelType_view_members(AngelType $angeltype, $members, $admin_user_ange $members_unconfirmed = []; foreach ($members as $member) { $member->name = User_Nick_render($member) . User_Pronoun_render($member); - $member['dect'] = $member->contact->dect; + if (config('enable_dect')) { + $member['dect'] = $member->contact->dect; + } if ($angeltype->requires_driver_license) { $member['wants_to_drive'] = icon_bool($member->license->wantsToDrive()); $member['has_car'] = icon_bool($member->license->has_car); @@ -313,8 +315,13 @@ function AngelType_view_members(AngelType $angeltype, $members, $admin_user_ange */ function AngelType_view_table_headers(AngelType $angeltype, $supporter, $admin_angeltypes) { + $headers = [ + 'name' => __('Nick'), + 'dect' => __('DECT'), + 'actions' => '' + ]; if ($angeltype->requires_driver_license && ($supporter || $admin_angeltypes)) { - return [ + $headers = [ 'name' => __('Nick'), 'dect' => __('DECT'), 'wants_to_drive' => __('Driver'), @@ -327,11 +334,10 @@ function AngelType_view_table_headers(AngelType $angeltype, $supporter, $admin_a 'actions' => '' ]; } - return [ - 'name' => __('Nick'), - 'dect' => __('DECT'), - 'actions' => '' - ]; + if (!config('enable_dect')) { + unset($headers['dect']); + } + return $headers; } /** @@ -498,7 +504,7 @@ function AngelTypes_render_contact_info(AngelType $angeltype) { $info = [ __('Name') => [$angeltype->contact_name, $angeltype->contact_name], - __('DECT') => [sprintf('%1$s', $angeltype->contact_dect), $angeltype->contact_dect], + __('DECT') => config('enable_dect') ? [sprintf('%1$s', $angeltype->contact_dect), $angeltype->contact_dect] : null, __('E-Mail') => [sprintf('%1$s', $angeltype->contact_email), $angeltype->contact_email], ]; $contactInfo = []; diff --git a/includes/view/User_view.php b/includes/view/User_view.php index ed80bee6..0fcf7371 100644 --- a/includes/view/User_view.php +++ b/includes/view/User_view.php @@ -91,12 +91,16 @@ function Users_view( $u['last_name'] = $user->personalData->last_name; $u['dect'] = sprintf('%1$s', $user->contact->dect); $u['arrived'] = icon_bool($user->state->arrived); - $u['got_voucher'] = $user->state->got_voucher; + if (config('enable_voucher')) { + $u['got_voucher'] = $user->state->got_voucher; + } $u['freeloads'] = $user->getAttribute('freeloads'); $u['active'] = icon_bool($user->state->active); $u['force_active'] = icon_bool($user->state->force_active); - $u['got_shirt'] = icon_bool($user->state->got_shirt); - $u['shirt_size'] = $user->personalData->shirt_size; + if (config('enable_tshirt_size')) { + $u['got_shirt'] = icon_bool($user->state->got_shirt); + $u['shirt_size'] = $user->personalData->shirt_size; + } $u['arrival_date'] = $user->personalData->planned_arrival_date ? $user->personalData->planned_arrival_date->format(__('Y-m-d')) : ''; $u['departure_date'] = $user->personalData->planned_departure_date @@ -129,12 +133,18 @@ function Users_view( $user_table_headers['dect'] = Users_table_header_link('dect', __('DECT'), $order_by); } $user_table_headers['arrived'] = Users_table_header_link('arrived', __('Arrived'), $order_by); - $user_table_headers['got_voucher'] = Users_table_header_link('got_voucher', __('Voucher'), $order_by); + if (config('enable_voucher')) { + $user_table_headers['got_voucher'] = Users_table_header_link('got_voucher', __('Voucher'), $order_by); + } $user_table_headers['freeloads'] = Users_table_header_link('freeloads', __('Freeloads'), $order_by); $user_table_headers['active'] = Users_table_header_link('active', __('Active'), $order_by); $user_table_headers['force_active'] = Users_table_header_link('force_active', __('Forced'), $order_by); - $user_table_headers['got_shirt'] = Users_table_header_link('got_shirt', __('T-Shirt'), $order_by); - $user_table_headers['shirt_size'] = Users_table_header_link('shirt_size', __('Size'), $order_by); + if (config('enable_tshirt_size')) { + $user_table_headers['got_shirt'] = Users_table_header_link('got_shirt', __('T-Shirt'), $order_by); + } + if (config('enable_tshirt_size')) { + $user_table_headers['shirt_size'] = Users_table_header_link('shirt_size', __('Size'), $order_by); + } $user_table_headers['arrival_date'] = Users_table_header_link( 'planned_arrival_date', __('Planned arrival'), @@ -510,7 +520,7 @@ function User_view( div('row', [ div('col-md-12', [ buttons([ - $auth->can('user.edit.shirt') ? button( + $auth->can('user.edit.shirt') && config('enable_tshirt_size') ? button( url('/admin/user/' . $user_source->id . '/shirt'), icon('person') . __('Shirt') ) : '', @@ -599,7 +609,7 @@ function User_view( ]), ($its_me || $admin_user_privilege) ? '