add config option for ifsg_light

This commit is contained in:
Xu 2023-08-25 20:33:14 +02:00 committed by Igor Scheller
parent d1d0acf622
commit 6b273288bd
4 changed files with 16 additions and 6 deletions

View File

@ -326,6 +326,10 @@ return [
# Instruction in accordance with § 43 Para. 1 of the German Infection Protection Act (IfSG)
'ifsg_enabled' => (bool) env('IFSG_ENABLED', false),
# Instruction only onsite in accordance with § 43 Para. 1 of the German Infection Protection Act (IfSG)
'ifsg_light_enabled' => (bool) env('IFSG_LIGHT_ENABLED', false)
&& env('IFSG_ENABLED', false),
// Available locales in /resources/lang/
'locales' => [
'de_DE' => 'Deutsch',

View File

@ -11,9 +11,11 @@
<div class="row">
<div class="col-md-12">
{{ m.info(__('settings.certificates.info')) }}
{% if config('ifsg_light_enabled') %}
{{ f.checkbox('ifsg_certificate_light', __('settings.ifsg_light'), {
'checked': ifsg_certificate_light,
}) }}
{% endif %}
{{ f.checkbox('ifsg_certificate', __('settings.ifsg'), {
'checked': ifsg_certificate,
}) }}

View File

@ -252,7 +252,9 @@ class SettingsController extends BaseController
throw new HttpNotFound('ifsg.disabled');
}
if (config('ifsg_light_enabled')) {
$user->license->ifsg_certificate_light = !$data['ifsg_certificate'] && $data['ifsg_certificate_light'];
}
$user->license->ifsg_certificate = (bool) $data['ifsg_certificate'];
$user->license->save();

View File

@ -583,6 +583,7 @@ class SettingsControllerTest extends ControllerTest
public function testIfsgCertificate(): void
{
config(['ifsg_enabled' => true]);
config(['ifsg_light_enabled' => true]);
$this->setExpects($this->auth, 'user', null, $this->user, $this->once());
$this->response->expects($this->once())
@ -629,6 +630,7 @@ class SettingsControllerTest extends ControllerTest
public function testSaveIfsgCertificateLight(): void
{
config(['ifsg_enabled' => true]);
config(['ifsg_light_enabled' => true]);
$this->setExpects($this->auth, 'user', null, $this->user, $this->once());
$body = [