diff --git a/config/config.default.php b/config/config.default.php
index 55982230..745d51ef 100644
--- a/config/config.default.php
+++ b/config/config.default.php
@@ -324,7 +324,7 @@ return [
],
# Instruction in accordance with § 43 Para. 1 of the German Infection Protection Act (IfSG)
- 'ifsg_enabled' => (bool) env('IFSG_ENABLED', false),
+ 'ifsg_enabled' => (bool) env('IFSG_ENABLED', true),
// Available locales in /resources/lang/
'locales' => [
diff --git a/db/migrations/2023_08_08_000000_add_requires_ifsg_cerificate_to_angeltypes.php b/db/migrations/2023_08_08_000000_add_requires_ifsg_cerificate_to_angeltypes.php
new file mode 100644
index 00000000..00b3e5b8
--- /dev/null
+++ b/db/migrations/2023_08_08_000000_add_requires_ifsg_cerificate_to_angeltypes.php
@@ -0,0 +1,33 @@
+schema->table('angel_types', function (Blueprint $table): void {
+ $table->boolean('requires_ifsg_certificate')->default(false)->after('requires_driver_license');
+ });
+ }
+
+ /**
+ * Reverse the migration
+ */
+ public function down(): void
+ {
+ $this->schema->table('angel_types', function (Blueprint $table): void {
+ $table->dropColumn('requires_ifsg_certificate');
+ });
+ }
+}
\ No newline at end of file
diff --git a/includes/controller/angeltypes_controller.php b/includes/controller/angeltypes_controller.php
index bf078a86..3d820446 100644
--- a/includes/controller/angeltypes_controller.php
+++ b/includes/controller/angeltypes_controller.php
@@ -123,6 +123,7 @@ function angeltype_edit_controller()
$angeltype->hide_register = $request->has('hide_register');
$angeltype->requires_driver_license = $request->has('requires_driver_license');
+ $angeltype->requires_ifsg_certificate = $request->has('requires_ifsg_certificate');
}
$angeltype->description = strip_request_item_nl('description', $angeltype->description);
@@ -139,6 +140,7 @@ function angeltype_edit_controller()
'Saved angeltype: ' . $angeltype->name . ($angeltype->restricted ? ', restricted' : '')
. ($angeltype->no_self_signup ? ', no_self_signup' : '')
. ($angeltype->requires_driver_license ? ', requires driver license' : '') . ', '
+ . ($angeltype->requires_ifsg_certificate ? ', requires ifsg certificate' : '') . ', '
. $angeltype->contact_name . ', '
. $angeltype->contact_dect . ', '
. $angeltype->contact_email . ', '
diff --git a/includes/view/AngelTypes_view.php b/includes/view/AngelTypes_view.php
index 8da72751..f2e1fe55 100644
--- a/includes/view/AngelTypes_view.php
+++ b/includes/view/AngelTypes_view.php
@@ -111,6 +111,18 @@ function AngelType_edit_view(AngelType $angeltype, bool $supporter_mode)
__('Requires driver license'),
$angeltype->requires_driver_license
),
+ $supporter_mode && config('ifsg_enabled')?
+ form_info(
+ __('requires IfSG certificate'),
+ $angeltype->requires_ifsg_certificate
+ ? __('Yes')
+ : __('No')
+ ) :
+ form_checkbox(
+ 'requires_ifsg_certificate',
+ __('requires IfSG certificate'),
+ $angeltype->requires_ifsg_certificate
+ ),
$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),
@@ -161,6 +173,12 @@ function AngelType_view_buttons(
icon('person-vcard') . __('my driving license')
);
}
+ if ($angeltype->requires_ifsg_certificate) {
+ $buttons[] = button(
+ user_driver_license_edit_link($user),
+ icon('card-checklist') . __('my ifsg certificate')
+ );
+ }
if (is_null($user_angeltype)) {
$buttons[] = button(
@@ -173,6 +191,10 @@ function AngelType_view_buttons(
error(__('This angeltype requires a driver license. Please enter your driver license information!'));
}
+ if ($angeltype->requires_ifsg_certificate && !$user->license->ifsg_certificate) {
+ error(__('This angeltype requires an ifsg certificate. Please enter your ifsg certificate information!'));
+ }
+
if ($angeltype->restricted && !$user_angeltype->confirm_user_id) {
error(sprintf(
__('You are unconfirmed for this angeltype. Please go to the introduction for %s to get confirmed.'),
diff --git a/includes/view/User_view.php b/includes/view/User_view.php
index 80107602..486ecf34 100644
--- a/includes/view/User_view.php
+++ b/includes/view/User_view.php
@@ -534,6 +534,11 @@ function User_view(
$needs_drivers_license = $needs_drivers_license || $angeltype->requires_driver_license;
}
+ $needs_ifsg_certificate = false;
+ foreach ($user_angeltypes as $angeltype) {
+ $needs_ifsg_certificate = $needs_ifsg_certificate || $angeltype->requires_ifsg_certificate;
+ }
+
return page_with_title(
' '
. (
@@ -560,6 +565,10 @@ function User_view(
user_driver_license_edit_link($user_source),
icon('person-vcard') . __('driving license')
) : '',
+ config('ifsg_enabled') && ($admin_user_privilege || ($its_me && $needs_drivers_license)) ? button(
+ page_link_to('settings/certificates'),
+ icon('card-checklist') . __('ifsg certificate')
+ ) : '',
(($admin_user_privilege || $auth->can('admin_arrive')) && !$user_source->state->arrived) ?
form([
form_hidden('action', 'arrived'),
diff --git a/resources/lang/de_DE/default.po b/resources/lang/de_DE/default.po
index 96c0aa79..31fecc0c 100644
--- a/resources/lang/de_DE/default.po
+++ b/resources/lang/de_DE/default.po
@@ -2207,21 +2207,33 @@ msgstr "Hier kannst Du Dein Theme ändern."
msgid "settings.theme.success"
msgstr "Theme wurde erfolgreich geändert."
-msgid settings.certificates
+msgid "settings.certificates"
msgstr "Zertifikate"
-msgid settings.certificates.info
+msgid "settings.certificates.info"
msgstr "Hier kannst du deine gemachte Gesundheitsbelehrung eintragen"
-msgid settings.ifsg
-msgstr "Kleines Frikadellendiplom ()"
+msgid "settings.ifsg"
+msgstr "Frikadellendiplom light: Du wurdest von c3gelb vor Ort nach ISfG §43 belehrt."
-msgid settings.ifsg_full
-msgstr "Großes Frikadellendiplom ()"
+msgid "settings.ifsg_full"
+msgstr "Frikadellendiplom: Du hast eine Belehrung nach §43 ISfG bei deinem Gesundheitsamt erhalten und innerhalb von 3 Monaten die Zweitbelehrung durch uns oder deinen Arbeitgeber/Koch/Verein bekommen. Zusätzlich ist die Zweibelehrung nicht älter als zwei Jahre."
-msgid settings.certificates.success
+msgid "settings.certificates.success"
msgstr "Gesundheitsbelehrung wurde erfolgreich geändert."
+msgid "requires IfSG certificate"
+msgstr "benötigt eine Gesundheitsbelehrung"
+
+msgid "ifsg certificate"
+msgstr "Gesundheitsbelehrung"
+
+msgid "my ifsg certificate"
+msgstr "Meine Gesundheitsbelehrung"
+
+msgid "This angeltype requires an ifsg certificate. Please enter your ifsg certificate information!"
+msgstr "Dieser Engeltyp benötigt eine Gesundheitsbelehrung. Bitte trage deine Gesundheitsbelehrung ein!"
+
msgid "settings.language"
msgstr "Sprache"
diff --git a/resources/lang/en_US/default.po b/resources/lang/en_US/default.po
index c18ba7ca..34478c75 100644
--- a/resources/lang/en_US/default.po
+++ b/resources/lang/en_US/default.po
@@ -311,14 +311,29 @@ msgstr "Theme was changed successfully."
msgid settings.certificates
msgstr "Certificates"
-msgid settings.certificates.info
+msgid "settings.certificates.info"
+msgstr "Here you can enter your health instruction"
-msgid settings.ifsg
+msgid "settings.ifsg"
+msgstr "Frikadellendiplom light: You were instructed from c3gelb about ISfG §43 on site."
-msgid settings.ifsg_full
+msgid "settings.ifsg_full"
+msgstr "Frikadellendiplom: You have gotten the instruction about §43 ISfG from your Health Department and a second instruction from us or your employer/chef/assosiation within 3 months. Additionally your second instruction is not older than 2 years."
-msgid settings.certificates.success
-msgstr "IfSG certificate was changed successfully."
+msgid "settings.certificates.success"
+msgstr "Health instruction was changed successfully."
+
+msgid "requires IfSG certificate"
+msgstr "requires health instruction"
+
+msgid "ifsg certificate"
+msgstr "health instruction"
+
+msgid "my ifsg certificate"
+msgstr "my health instruction"
+
+msgid "This angeltype requires an ifsg certificate. Please enter your ifsg certificate information!"
+msgstr ""This angeltype requires a health instruction. Please enter your health instruction information!""
msgid "settings.language"
msgstr "Language"
diff --git a/src/Controllers/SettingsController.php b/src/Controllers/SettingsController.php
index 33de0f28..fe4f0adf 100644
--- a/src/Controllers/SettingsController.php
+++ b/src/Controllers/SettingsController.php
@@ -225,7 +225,7 @@ class SettingsController extends BaseController
public function ifsgCertificate(): Response
{
$user = $this->auth->user();
- if (config('ifsg_enabled')) {
+ if (!config('ifsg_enabled')) {
throw new HttpNotFound('ifsg.disabled');
}
return $this->response->withView(
@@ -246,7 +246,7 @@ class SettingsController extends BaseController
'ifsg_certificate_full' => 'optional|checked'
]);
- if (config('ifsg_enabled')) {
+ if (!config('ifsg_enabled')) {
throw new HttpNotFound('ifsg.disabled');
}
diff --git a/src/Models/AngelType.php b/src/Models/AngelType.php
index 4438106f..a1f41436 100644
--- a/src/Models/AngelType.php
+++ b/src/Models/AngelType.php
@@ -23,6 +23,7 @@ use Illuminate\Database\Query\Builder as QueryBuilder;
* @property string $contact_email
* @property boolean $restricted # If users need an introduction
* @property boolean $requires_driver_license # If users must have a driver license
+ * @property boolean $requires_ifsg_certificate # If users must have a ifsg certificate
* @property boolean $no_self_signup # Users can sign up for shifts
* @property boolean $show_on_dashboard # Show on public dashboard
* @property boolean $hide_register # Hide from registration page
@@ -59,6 +60,7 @@ class AngelType extends BaseModel
'restricted',
'requires_driver_license',
+ 'requires_ifsg_certificate',
'no_self_signup',
'show_on_dashboard',
'hide_register',
@@ -66,11 +68,12 @@ class AngelType extends BaseModel
/** @var array */
protected $casts = [ // phpcs:ignore
- 'restricted' => 'boolean',
- 'requires_driver_license' => 'boolean',
- 'no_self_signup' => 'boolean',
- 'show_on_dashboard' => 'boolean',
- 'hide_register' => 'boolean',
+ 'restricted' => 'boolean',
+ 'requires_driver_license' => 'boolean',
+ 'requires_ifsg_certificate' => 'boolean',
+ 'no_self_signup' => 'boolean',
+ 'show_on_dashboard' => 'boolean',
+ 'hide_register' => 'boolean',
];
public function neededBy(): HasMany