add option to hide angeltype at registration

This commit is contained in:
Xu 2022-10-21 22:20:06 +02:00
parent ff1dfd5a18
commit b860b37ba9
7 changed files with 69 additions and 8 deletions

View File

@ -0,0 +1,43 @@
<?php
namespace Engelsystem\Migrations;
use Engelsystem\Database\Migration\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddHideRegisterToAngeltypes extends Migration
{
/**
* Run the migration
*/
public function up()
{
if (!$this->schema->hasTable('AngelTypes')) {
return;
}
$this->schema->table(
'AngelTypes',
function (Blueprint $table) {
$table->boolean('hide_register')->default(false)->after('show_on_dashboard');
}
);
}
/**
* Reverse the migration
*/
public function down()
{
if (!$this->schema->hasTable('AngelTypes')) {
return;
}
$this->schema->table(
'AngelTypes',
function (Blueprint $table) {
$table->dropColumn('hide_register');
}
);
}
}

View File

@ -139,6 +139,7 @@ function angeltype_edit_controller()
$angeltype['restricted'] = $request->has('restricted');
$angeltype['no_self_signup'] = $request->has('no_self_signup');
$angeltype['show_on_dashboard'] = $request->has('show_on_dashboard');
$angeltype['hide_register'] = $request->has('hide_register');
$angeltype['requires_driver_license'] = $request->has('requires_driver_license');
}

View File

@ -19,7 +19,8 @@ function AngelType_new()
'contact_name' => null,
'contact_dect' => null,
'contact_email' => null,
'show_on_dashboard' => true
'show_on_dashboard' => true,
'hide_register' => false
];
}
@ -69,7 +70,8 @@ function AngelType_update($angeltype)
`contact_name` = ?,
`contact_dect` = ?,
`contact_email` = ?,
`show_on_dashboard` = ?
`show_on_dashboard` = ?,
`hide_register` = ?
WHERE `id` = ?
',
[
@ -82,6 +84,7 @@ function AngelType_update($angeltype)
$angeltype['contact_dect'],
$angeltype['contact_email'],
(int)$angeltype['show_on_dashboard'],
(int)$angeltype['hide_register'],
$angeltype['id'],
]
);
@ -93,7 +96,8 @@ function AngelType_update($angeltype)
. $angeltype['contact_name'] . ', '
. $angeltype['contact_dect'] . ', '
. $angeltype['contact_email'] . ', '
. $angeltype['show_on_dashboard']
. $angeltype['show_on_dashboard'] . ', '
. $angeltype['hide_register']
);
}
@ -116,9 +120,10 @@ function AngelType_create($angeltype)
`contact_name`,
`contact_dect`,
`contact_email`,
`show_on_dashboard`
`show_on_dashboard`,
`hide_register`
)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
',
[
$angeltype['name'],
@ -129,7 +134,8 @@ function AngelType_create($angeltype)
$angeltype['contact_name'],
$angeltype['contact_dect'],
$angeltype['contact_email'],
(int)$angeltype['show_on_dashboard']
(int)$angeltype['show_on_dashboard'],
(int)$angeltype['hide_register'],
]
);
@ -141,7 +147,8 @@ function AngelType_create($angeltype)
. $angeltype['contact_name'] . ', '
. $angeltype['contact_dect'] . ', '
. $angeltype['contact_email'] . ', '
. $angeltype['show_on_dashboard']
. $angeltype['show_on_dashboard'] . ', '
. $angeltype['hide_register']
);
return $angeltype;

View File

@ -75,8 +75,11 @@ function guest_register()
}
}
foreach ($angel_types_source as $angel_type) {
if ($angel_type['hide_register']) {
continue;
}
$angel_types[$angel_type['id']] = $angel_type['name']
. ($angel_type['restricted'] ? ' (' . __('Requires introduction') . ')' : '');
. ($angel_type['restricted'] ? ' (' . __('Requires introduction') . ')' : '');
if (!$angel_type['restricted']) {
$selected_angel_types[] = $angel_type['id'];
}

View File

@ -111,6 +111,9 @@ function AngelType_edit_view($angeltype, $supporter_mode)
$supporter_mode
? form_info(__('Show on dashboard'), $angeltype['show_on_dashboard'] ? __('Yes') : __('No'))
: form_checkbox('show_on_dashboard', __('Show on dashboard'), $angeltype['show_on_dashboard']),
$supporter_mode
? form_info(__('Hide at Registration'), $angeltype['hide_register'] ? __('Yes') : __('No'))
: form_checkbox('hide_register', __('Hide at Registration'), $angeltype['hide_register']),
form_textarea('description', __('Description'), $angeltype['description']),
form_info('', __('Please use markdown for the description.')),
heading(__('Contact'), 3),

View File

@ -2429,6 +2429,9 @@ msgstr "Möchtest Du wirklich %s zu %s hinzufügen?"
msgid "Confirm user"
msgstr "Benutzer bestätigen"
msgid "Hide at Registration"
msgstr "Ausblenden bei Registrierung"
#: includes/view/UserAngelTypes_view.php:176
msgid "save"
msgstr "Speichern"

View File

@ -58,6 +58,7 @@ trait HasDatabase
['migration' => '2021_12_30_000000_remove_admin_news_html_privilege'],
['migration' => '2022_06_02_000000_create_voucher_edit_permission'],
['migration' => '2022_06_03_000000_shifts_add_transaction_id'],
['migration' => '2022_10_21_000000_add_hide_register_to_angeltypes'],
]
);