Feste Profilfelder in Formularen, Geburtstage, anpassbare Startseite
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 2m18s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 2m21s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 2m40s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 2m34s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 3m8s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 3m6s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 2m43s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 2m47s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m1s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 2m18s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 2m21s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 2m40s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 2m34s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 3m8s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 3m6s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 2m43s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 2m47s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m1s
- Formulare: Felder fest aus dem Profil (nicht änderbar, Server setzt den Profilwert ein), Hinweis bei fehlender Profilangabe - Geburtstage (optionales Plugin, standardmäßig aus): Tag und Monat freiwillig im Profil, Kachel, Liste /geburtstage, Pagebuilder-Block, Glückwunsch am eigenen Geburtstag; Sichtbarkeit alle/Abteilung/Standort - Startseite: Kacheln je Bereich sortieren und ausblenden; eigene Kacheln (Bild mit Link, Text, Hinweis) mit Zeitraum und Zielgruppe - Kern: optionale mitgelieferte Plugins, Startseitenbereich „top“, Profilabschnitte für Plugins, Kachel-Bezeichnungen Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
435960725d
commit
ee8dde93c0
262 changed files with 2385 additions and 692 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Tests\Feature\Forms;
|
||||
|
||||
use App\Models\ProfileField;
|
||||
use App\Models\Role;
|
||||
use App\Models\User;
|
||||
use App\Notifications\PortalNotification;
|
||||
|
|
@ -339,4 +340,52 @@ class FormsTest extends TestCase
|
|||
Audiences::sync('form', $form->id, ['department' => ['Verwaltung']]);
|
||||
$this->assertSame([], $content->render($content->sanitize(['blocks' => [['type' => 'forms.form', 'data' => ['form' => (string) $form->id]]]]), $this->employee)['blocks']);
|
||||
}
|
||||
|
||||
public function test_locked_profile_fields_always_use_the_profile_value(): void
|
||||
{
|
||||
ProfileField::query()->create(['key' => 'personalnummer', 'label' => 'Personalnummer', 'editable' => false]);
|
||||
$this->employee->update(['custom_fields' => ['personalnummer' => 'P-4711'], 'location' => null]);
|
||||
|
||||
$form = Form::query()->create(['title' => 'Stammdaten', 'fields' => [
|
||||
['type' => 'text', 'data' => ['label' => 'Vorname', 'prefill' => 'first_name', 'locked' => true, 'required' => true]],
|
||||
['type' => 'text', 'data' => ['label' => 'Personalnummer', 'prefill' => 'custom.personalnummer', 'locked' => true, 'required' => true]],
|
||||
['type' => 'text', 'data' => ['label' => 'Standort', 'prefill' => 'location', 'locked' => true, 'required' => true]],
|
||||
['type' => 'text', 'data' => ['label' => 'Abteilung', 'prefill' => 'department']],
|
||||
]]);
|
||||
|
||||
$this->actingAs($this->employee)->get($form->url())->assertInertia(fn (Assert $p) => $p
|
||||
->where('form.fields.0.locked', true)
|
||||
->where('form.fields.1.locked', true)
|
||||
->where('form.prefill.personalnummer', 'P-4711')
|
||||
->missing('form.fields.3.locked'));
|
||||
|
||||
// Standort fehlt im Profil → Hinweis statt Einsendung.
|
||||
$this->post($form->url(), ['answers' => ['vorname' => 'Gefälscht', 'personalnummer' => 'X-0000']])
|
||||
->assertSessionHasErrors(['answers.standort' => 'Diese Angabe fehlt in Ihrem Profil. Bitte ergänzen Sie sie dort (Profil bearbeiten) oder wenden Sie sich an die Personalverwaltung.']);
|
||||
|
||||
$this->employee->update(['location' => 'Hamburg']);
|
||||
$this->post($form->url(), ['answers' => ['vorname' => 'Gefälscht', 'personalnummer' => 'X-0000', 'abteilung' => 'Selbst geändert']])->assertSessionHasNoErrors();
|
||||
|
||||
$submission = FormSubmission::query()->sole();
|
||||
$this->assertSame('Anna', $submission->display('vorname'), 'Manipulierte Eingaben werden durch den Profilwert ersetzt.');
|
||||
$this->assertSame('P-4711', $submission->display('personalnummer'));
|
||||
$this->assertSame('Hamburg', $submission->display('standort'));
|
||||
$this->assertSame('Selbst geändert', $submission->display('abteilung'), 'Nur vorbelegte Felder bleiben änderbar.');
|
||||
}
|
||||
|
||||
public function test_builder_keeps_lock_only_with_prefill(): void
|
||||
{
|
||||
$this->actingAs(User::factory()->admin()->create());
|
||||
$form = $this->trainingForm();
|
||||
|
||||
$saved = $this->putJson(route('forms.builder.update', $form), ['title' => 'x', 'fields' => [
|
||||
['type' => 'text', 'data' => ['label' => 'Vorname', 'prefill' => 'first_name', 'locked' => true]],
|
||||
['type' => 'text', 'data' => ['label' => 'Frei', 'locked' => true]],
|
||||
['type' => 'textarea', 'data' => ['label' => 'Text', 'prefill' => 'name', 'locked' => true]],
|
||||
]])->assertOk()->json('fields');
|
||||
|
||||
$this->assertTrue($saved[0]['data']['locked']);
|
||||
$this->assertArrayNotHasKey('locked', $saved[1]['data']);
|
||||
$this->assertArrayNotHasKey('locked', $saved[2]['data']);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue