Merge branch 'dasJ-dect'

This commit is contained in:
msquare 2019-04-23 21:10:51 +02:00
commit b74835a096
4 changed files with 17 additions and 9 deletions

View File

@ -99,6 +99,9 @@ return [
// The minimum length for passwords // The minimum length for passwords
'min_password_length' => 8, 'min_password_length' => 8,
// Whether the DECT field should be enabled
'enable_dect' => true,
// Enables the planned arrival/leave date // Enables the planned arrival/leave date
'enable_planned_arrival' => true, 'enable_planned_arrival' => true,

View File

@ -55,7 +55,9 @@ function admin_user()
$html .= ' <tr><td>Name</td><td>' . '<input size="40" name="eName" value="' . $user_source->personalData->last_name . '" class="form-control"></td></tr>' . "\n"; $html .= ' <tr><td>Name</td><td>' . '<input size="40" name="eName" value="' . $user_source->personalData->last_name . '" class="form-control"></td></tr>' . "\n";
$html .= ' <tr><td>Vorname</td><td>' . '<input size="40" name="eVorname" value="' . $user_source->personalData->first_name . '" class="form-control"></td></tr>' . "\n"; $html .= ' <tr><td>Vorname</td><td>' . '<input size="40" name="eVorname" value="' . $user_source->personalData->first_name . '" class="form-control"></td></tr>' . "\n";
$html .= ' <tr><td>Handy</td><td>' . '<input type= "tel" size="40" name="eHandy" value="' . $user_source->contact->mobile . '" class="form-control"></td></tr>' . "\n"; $html .= ' <tr><td>Handy</td><td>' . '<input type= "tel" size="40" name="eHandy" value="' . $user_source->contact->mobile . '" class="form-control"></td></tr>' . "\n";
if (config('enable_dect')) {
$html .= ' <tr><td>DECT</td><td>' . '<input size="40" name="eDECT" value="' . $user_source->contact->dect . '" class="form-control"></td></tr>' . "\n"; $html .= ' <tr><td>DECT</td><td>' . '<input size="40" name="eDECT" value="' . $user_source->contact->dect . '" class="form-control"></td></tr>' . "\n";
}
if ($user_source->settings->email_human) { if ($user_source->settings->email_human) {
$html .= " <tr><td>email</td><td>" . '<input type="email" size="40" name="eemail" value="' . $user_source->email . '" class="form-control"></td></tr>' . "\n"; $html .= " <tr><td>email</td><td>" . '<input type="email" size="40" name="eemail" value="' . $user_source->email . '" class="form-control"></td></tr>' . "\n";
} }

View File

@ -42,6 +42,7 @@ function guest_register()
$authUser = auth()->user(); $authUser = auth()->user();
$tshirt_sizes = config('tshirt_sizes'); $tshirt_sizes = config('tshirt_sizes');
$enable_tshirt_size = config('enable_tshirt_size'); $enable_tshirt_size = config('enable_tshirt_size');
$enable_dect = config('enable_dect');
$enable_planned_arrival = config('enable_planned_arrival'); $enable_planned_arrival = config('enable_planned_arrival');
$min_password_length = config('min_password_length'); $min_password_length = config('min_password_length');
$config = config(); $config = config();
@ -168,7 +169,7 @@ function guest_register()
if ($request->has('prename')) { if ($request->has('prename')) {
$preName = strip_request_item('prename'); $preName = strip_request_item('prename');
} }
if ($request->has('dect')) { if ($enable_dect && $request->has('dect')) {
if (strlen(strip_request_item('dect')) <= 40) { if (strlen(strip_request_item('dect')) <= 40) {
$dect = strip_request_item('dect'); $dect = strip_request_item('dect');
} else { } else {
@ -340,10 +341,10 @@ function guest_register()
]), ]),
div('col-md-6', [ div('col-md-6', [
div('row', [ div('row', [
div('col-sm-4', [ $enable_dect ? div('col-sm-4', [
form_text('dect', __('DECT'), $dect) form_text('dect', __('DECT'), $dect)
]), ]) : '',
div('col-sm-4', [ div($enable_dect ? 'col-sm-4' : 'col-sm-12', [
form_text('mobile', __('Mobile'), $mobile) form_text('mobile', __('Mobile'), $mobile)
]), ]),
]), ]),

View File

@ -25,7 +25,9 @@ function User_settings_view(
$tshirt_sizes $tshirt_sizes
) { ) {
$personalData = $user_source->personalData; $personalData = $user_source->personalData;
$enable_dect = config('enable_dect');
$enable_planned_arrival = config('enable_planned_arrival'); $enable_planned_arrival = config('enable_planned_arrival');
return page_with_title(settings_title(), [ return page_with_title(settings_title(), [
msg(), msg(),
div('row', [ div('row', [
@ -50,7 +52,7 @@ function User_settings_view(
$buildup_start_date, $buildup_start_date,
$teardown_end_date $teardown_end_date
) : '', ) : '',
form_text('dect', __('DECT'), $user_source->contact->dect), $enable_dect ? form_text('dect', __('DECT'), $user_source->contact->dect) : '',
form_text('mobile', __('Mobile'), $user_source->contact->mobile), form_text('mobile', __('Mobile'), $user_source->contact->mobile),
form_text('mail', __('E-Mail') . ' ' . entry_required(), $user_source->email), form_text('mail', __('E-Mail') . ' ' . entry_required(), $user_source->email),
form_checkbox( form_checkbox(
@ -954,7 +956,7 @@ function render_user_tshirt_hint()
function render_user_dect_hint() function render_user_dect_hint()
{ {
$user = auth()->user(); $user = auth()->user();
if ($user->state->arrived && !$user->contact->dect) { if ($user->state->arrived && config('enable_dect') && !$user->contact->dect) {
$text = __('You need to specify a DECT phone number in your settings! If you don\'t have a DECT phone, just enter \'-\'.'); $text = __('You need to specify a DECT phone number in your settings! If you don\'t have a DECT phone, just enter \'-\'.');
return render_profile_link($text, null, 'alert-link'); return render_profile_link($text, null, 'alert-link');
} }