FL statt VL, Stufen 1 bis 7
Die Angabe heisst ueberall "FL" (Einstellung, Wiedereintritt, Daten aendern,
Akte, Zusammenfassung, Export, Austauschdatei). Gespeichert bleibt sie in
vl, in Historie und Feldkarte als "VL"; anzeige() zeigt dort "FL".
Migration 20261201120000: chk_vl auf 1 bis 7. Bestand mit 8 wird geleert
und je Person im Protokoll vermerkt ("FL geleert"). Geplante Aenderungen
auf 8 verlieren diese Angabe in Vormerkung und Historienzeile; bleibt
nichts uebrig, entfaellt der Vorgang samt Zeile. Jeweils Protokolleintrag.
Geprueft: lint, tsc, types:check, npm test (1123), waechter; Migrationen auf
leerer Datenbank zweimal (Nichts anzuwenden), rauchtest.sql,
vertragsangaben.sql (FL 8 abgewiesen, Wiedereintritt mit FL 6); Bestand
mit FL 8, geplanter Aenderung FL 8 plus Bonus und geplanter Aenderung nur
FL 8: geleert, Bonus bleibt vorgemerkt, Vorgang entfaellt.
This commit is contained in:
@@ -115,7 +115,7 @@ function employeeExportColumns(
|
||||
// weiterverarbeiten, die Bezeichnung das, was ein Mensch liest.
|
||||
{ header: "C-Level", get: (e) => e.c_level },
|
||||
{ header: "Hay-Grade", get: (e) => e.paygrade },
|
||||
{ header: "VL", get: (e) => e.vl },
|
||||
{ header: "FL", get: (e) => e.vl },
|
||||
{ header: "Bonusanspruch", get: (e) => e.has_bonusanspruch },
|
||||
{ header: "Bonusregelung", get: (e) => e.bonusanspruch_art },
|
||||
{ header: "Herkunft", get: (e) => e.source },
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { SelectField } from "@/components/ui/Field";
|
||||
import { BONUSREGELUNGEN, VL_STUFEN } from "@/lib/vertragsangaben";
|
||||
|
||||
// VL und Bonusanspruch — dieselben Felder im Einstellungsassistenten, im
|
||||
// FL und Bonusanspruch — dieselben Felder im Einstellungsassistenten, im
|
||||
// Wiedereintritt und in „Daten ändern". Eine Komponente statt drei Kopien,
|
||||
// wie bei „Anstellungsart": drei Kopien laufen auseinander, und dann
|
||||
// bietet eine Stelle eine Bonusregelung an, die eine andere nicht kennt.
|
||||
@@ -28,7 +28,7 @@ export function VertragsangabenFields({
|
||||
return (
|
||||
<>
|
||||
<SelectField
|
||||
label="VL"
|
||||
label="FL"
|
||||
dense={dense}
|
||||
value={value.vl}
|
||||
onChange={(vl) => onChange({ vl })}
|
||||
|
||||
@@ -87,7 +87,7 @@ export function VertragTab({
|
||||
// Kollektivvertrag und wird hier nicht geführt. Eine feste Zahl für alle
|
||||
// wäre erfunden, und eine erfundene Zahl ist schlechter als keine.
|
||||
["Hay-Grade", hayGradeLabel(employee.paygrade)],
|
||||
["VL", vlLabel(employee.vl)],
|
||||
["FL", vlLabel(employee.vl)],
|
||||
// Wie beim Dienstwagen: statt eines blossen „Ja" gleich die Regelung.
|
||||
["Bonusanspruch", ohneVorgabe(employee, ["has_bonusanspruch"], bonusanspruchLabel(employee.has_bonusanspruch, employee.bonusanspruch_art))],
|
||||
["Beschäftigtengruppe", ohneVorgabe(employee, ["worker_type"], anzeige(employee.worker_type) ?? "–")],
|
||||
|
||||
@@ -80,7 +80,7 @@ export function StepSummary({ draft, selectedPosition, locations, extern = false
|
||||
["Vertragsart", draft.contractType === "befristet" ? `befristet bis ${fmtDate(draft.contractEndDate)}` : "unbefristet"],
|
||||
["Beschäftigungsausmaß", `${draft.employmentType} (${draft.weeklyHours} h)`],
|
||||
["Hay-Grade", hayGradeLabel(draft.paygrade)],
|
||||
["VL", draft.vl || "–"],
|
||||
["FL", draft.vl || "–"],
|
||||
["Bonusanspruch", bonusanspruchLabel(draft.hasBonusanspruch, draft.bonusanspruchArt)],
|
||||
["Beschäftigtengruppe", anzeige(draft.workerType)],
|
||||
...(draft.workerType === "Lehrling"
|
||||
|
||||
@@ -84,7 +84,7 @@ export type HireDraftData = {
|
||||
teilzeitBis: string;
|
||||
/** Leer heisst „noch nicht bewertet" und ist der Normalfall beim Anlegen. */
|
||||
paygrade: PaygradeType | "";
|
||||
/** VL 1–8 als Text; "" heisst nicht erfasst. */
|
||||
/** FL 1–7 als Text; "" heisst nicht erfasst. */
|
||||
vl: string;
|
||||
hasBonusanspruch: boolean;
|
||||
/** Nur ausgewertet, wenn hasBonusanspruch gesetzt ist — so will es der CHECK. */
|
||||
|
||||
78
db/migrations/20261201120000_fl_ohne_stufe_8.sql
Normal file
78
db/migrations/20261201120000_fl_ohne_stufe_8.sql
Normal file
@@ -0,0 +1,78 @@
|
||||
-- FL: Stufen 1 bis 7
|
||||
--
|
||||
-- Die Angabe heisst fachlich „FL" und kennt die Stufen 1 bis 7. Gespeichert
|
||||
-- bleibt sie in der Spalte vl, und in der Historie und der Feldkarte heisst
|
||||
-- das Feld weiter „VL": daran hängen Berichtigen und Zurücksetzen bestehender
|
||||
-- Einträge. Die Oberfläche zeigt „FL" (lib/anzeige.ts).
|
||||
--
|
||||
-- Bestand mit Stufe 8: welche Stufe stattdessen gilt, geht aus den Daten
|
||||
-- nicht hervor. Die Angabe wird geleert und je Person im Protokoll vermerkt;
|
||||
-- ein geratener Wert sähe aus wie ein erfasster. Geplante Änderungen auf
|
||||
-- Stufe 8 verlieren diese eine Angabe, in der Vormerkung und in ihrer
|
||||
-- Historienzeile; der Rest des Vorgangs bleibt. Bleibt nichts übrig, entfällt
|
||||
-- der Vorgang samt Zeile, wie beim Abbrechen in der Historie.
|
||||
|
||||
do $geplant$
|
||||
declare
|
||||
v_plan record;
|
||||
v_payload jsonb;
|
||||
begin
|
||||
for v_plan in
|
||||
select * from pending_org_changes
|
||||
where status = 'pending' and payload->'contract'->>'vl' = '8'
|
||||
loop
|
||||
v_payload := jsonb_set(v_plan.payload, '{contract}', (v_plan.payload->'contract') - 'vl');
|
||||
|
||||
insert into audit_log (actor_user_id, actor_name, action, target_label, target_employee_id, details)
|
||||
select null, 'Wartung', 'Geplante Änderung angepasst', e.first_name || ' ' || e.last_name, e.id,
|
||||
'Zum ' || v_plan.effective_date || ' war FL 8 vorgemerkt. Die Stufe 8 gibt es nicht mehr; '
|
||||
|| 'diese Angabe entfällt aus dem Vorgang.'
|
||||
from employees e where e.id = v_plan.employee_id;
|
||||
|
||||
if coalesce(v_payload->'person', '{}'::jsonb) = '{}'::jsonb
|
||||
and coalesce(v_payload->'contract', '{}'::jsonb) = '{}'::jsonb
|
||||
and coalesce(v_payload->'role', '{}'::jsonb) = '{}'::jsonb then
|
||||
update pending_org_changes set status = 'cancelled' where id = v_plan.id;
|
||||
delete from employee_history where pending_id = v_plan.id;
|
||||
else
|
||||
update pending_org_changes set payload = v_payload where id = v_plan.id;
|
||||
-- In der Beschreibung steht die Liste der Felder, jedes gefolgt von
|
||||
-- einem Komma („Geänderte Felder: VL, Bonusanspruch, wirksam ab …").
|
||||
update employee_history h
|
||||
set changes = (select coalesce(jsonb_agg(a), '[]'::jsonb)
|
||||
from jsonb_array_elements(h.changes) a
|
||||
where a->>'feld' <> 'VL'),
|
||||
description = replace(h.description, 'VL, ', '')
|
||||
where h.pending_id = v_plan.id;
|
||||
end if;
|
||||
end loop;
|
||||
end
|
||||
$geplant$;
|
||||
|
||||
insert into audit_log (actor_user_id, actor_name, action, target_label, target_employee_id, details)
|
||||
select null, 'Wartung', 'FL geleert', e.first_name || ' ' || e.last_name, e.id,
|
||||
'Die Stufe 8 gibt es nicht mehr; FL war 8 und ist jetzt leer. Bitte die zutreffende Stufe (1 bis 7) nachtragen.'
|
||||
from employees e
|
||||
where e.vl = 8;
|
||||
|
||||
update employees set vl = null where vl = 8;
|
||||
|
||||
alter table employees drop constraint if exists chk_vl;
|
||||
alter table employees add constraint chk_vl check (vl is null or vl between 1 and 7);
|
||||
|
||||
comment on column employees.vl is 'FL, Stufe 1 bis 7; leer heisst nicht erfasst. In Historie und Feldkarte als „VL" geführt.';
|
||||
|
||||
do $pruefung$
|
||||
begin
|
||||
if exists (select 1 from employees where vl not between 1 and 7) then
|
||||
raise exception 'Es gibt noch FL-Werte ausserhalb von 1 bis 7.';
|
||||
end if;
|
||||
if exists (select 1 from pending_org_changes where status = 'pending' and payload->'contract'->>'vl' = '8') then
|
||||
raise exception 'Es gibt noch geplante Änderungen auf FL 8.';
|
||||
end if;
|
||||
if pg_get_constraintdef((select oid from pg_constraint where conname = 'chk_vl' and conrelid = 'public.employees'::regclass))
|
||||
not like '%vl >= 1%vl <= 7%' then
|
||||
raise exception 'chk_vl erlaubt nicht genau 1 bis 7.';
|
||||
end if;
|
||||
end
|
||||
$pruefung$;
|
||||
@@ -149,14 +149,14 @@ begin
|
||||
perform hire_employee(jsonb_build_object(
|
||||
'personnel_number', v_nr + 2, 'first_name', 'X', 'last_name', 'Y', 'gender', 'm',
|
||||
'birth_date', '1980-01-01', 'location_id', v_ort, 'position_id', v_p3,
|
||||
'entry_date', current_date::text, 'vl', 9));
|
||||
'entry_date', current_date::text, 'vl', 8));
|
||||
v_ging := true;
|
||||
exception when others then v_ging := false;
|
||||
end;
|
||||
if v_ging then
|
||||
raise exception '3: VL 9 wurde angenommen.';
|
||||
raise exception '3: FL 8 wurde angenommen.';
|
||||
end if;
|
||||
raise notice '3/9 Abgewiesen: Bonus ohne Regelung, abgeschaltete HR, „Süßwaren", VL 9';
|
||||
raise notice '3/9 Abgewiesen: Bonus ohne Regelung, abgeschaltete HR, „Süßwaren", FL 8';
|
||||
|
||||
-- ── 4. Daten ändern, sofort ────────────────────────────────────
|
||||
perform change_employee_data(jsonb_build_object(
|
||||
@@ -271,16 +271,16 @@ begin
|
||||
'employee_id', v_a, 'rehire_date', current_date::text, 'position_id', v_p3,
|
||||
'first_name', 'Vertrag', 'last_name', 'Test-A', 'gender', 'w',
|
||||
'birth_date', '1990-01-01', 'nationality', 'Österreich', 'location_id', v_ort,
|
||||
'vl', 8, 'has_bonusanspruch', false, 'zustaendige_hr_id', v_hr1,
|
||||
'vl', 6, 'has_bonusanspruch', false, 'zustaendige_hr_id', v_hr1,
|
||||
'collective_agreement', 'Süßware Angestellter', 'erlernter_beruf', 'Bäckerin'));
|
||||
select * into v_e from employees where id = v_a;
|
||||
if v_e.vl <> 8 or v_e.has_bonusanspruch or v_e.bonusanspruch_art is not null
|
||||
if v_e.vl <> 6 or v_e.has_bonusanspruch or v_e.bonusanspruch_art is not null
|
||||
or v_e.zustaendige_hr_id <> v_hr1 or v_e.collective_agreement::text <> 'Süßware Angestellter'
|
||||
or v_e.erlernter_beruf is distinct from 'Bäckerin' then
|
||||
raise exception '9: Wiedereintritt hat VL/Bonus/HR/KV nicht übernommen: % % % % %',
|
||||
v_e.vl, v_e.has_bonusanspruch, v_e.bonusanspruch_art, v_e.zustaendige_hr_id, v_e.collective_agreement;
|
||||
end if;
|
||||
raise notice '9/9 Wiedereintritt übernimmt VL 8, Bonus Nein, HR und Süßware Angestellter';
|
||||
raise notice '9/9 Wiedereintritt übernimmt FL 6, Bonus Nein, HR und Süßware Angestellter';
|
||||
|
||||
raise notice 'Vertragsangaben-Rauchtest bestanden. Alles Angelegte wird gleich verworfen.';
|
||||
end
|
||||
|
||||
@@ -41,6 +41,8 @@ const REGELN: readonly (readonly [RegExp, string])[] = [
|
||||
// Ganze Wörter, die fachlich anders heissen als gespeichert.
|
||||
const UMBENANNT: readonly (readonly [RegExp, string])[] = [
|
||||
[new RegExp(`(?<![${BUCHSTABE}])Schwangerschaft(?![${BUCHSTABE}])`, "g"), "Mutterschutz"],
|
||||
// Das Feld „VL" der Historie heisst fachlich „FL" (Migration 20261201120000).
|
||||
[new RegExp(`(?<![${BUCHSTABE}])VL(?![${BUCHSTABE}])`, "g"), "FL"],
|
||||
];
|
||||
|
||||
// Das Ende einer Langzeitabwesenheit heisst fachlich „Endet am", nicht
|
||||
|
||||
@@ -21,7 +21,7 @@ export type Format =
|
||||
| { art: "text" }
|
||||
| { art: "datum" }
|
||||
| { art: "zahl"; nachkomma: number }
|
||||
/** Mit `bereich` nur Werte von–bis (VL 1–8). */
|
||||
/** Mit `bereich` nur Werte von–bis (FL 1–7). */
|
||||
| { art: "ganzzahl"; bereich?: readonly [number, number] }
|
||||
| { art: "janein" }
|
||||
/**
|
||||
|
||||
@@ -256,7 +256,7 @@ const MITARBEITER_ROH: Spalte[] = [
|
||||
}),
|
||||
// Eine Zahl, wie in der Spalte; in Excel eine Auswahl 1 bis 8. Die Auswahl
|
||||
// in „Eintrag berichtigen" führt sie als Text.
|
||||
feld("Vertrag und Arbeitszeit", "VL", "VL", "vl", { art: "ganzzahl", bereich: [VL_STUFEN[0], VL_STUFEN[VL_STUFEN.length - 1]] }),
|
||||
feld("Vertrag und Arbeitszeit", "FL", "VL", "vl", { art: "ganzzahl", bereich: [VL_STUFEN[0], VL_STUFEN[VL_STUFEN.length - 1]] }),
|
||||
feld("Vertrag und Arbeitszeit", "Bonusanspruch", "Bonusanspruch", "has_bonusanspruch", JA_NEIN),
|
||||
feld("Vertrag und Arbeitszeit", "Bonusregelung", "Bonusregelung", "bonusanspruch_art", auswahlAusKarte("Bonusregelung"), {
|
||||
hinweis: "Pflicht bei Bonusanspruch „Ja“, sonst leer.",
|
||||
|
||||
@@ -290,7 +290,7 @@ export type Database = {
|
||||
contract_end_date: string | null;
|
||||
/** Null heisst „noch nicht bewertet" — die Vorgabe. */
|
||||
paygrade: PaygradeType | null;
|
||||
/** VL, Stufe 1 bis 8 — chk_vl. Null heisst nicht erfasst. */
|
||||
/** FL, Stufe 1 bis 7 — chk_vl. Null heisst nicht erfasst. */
|
||||
vl: number | null;
|
||||
has_bonusanspruch: boolean;
|
||||
/** Null genau dann, wenn kein Bonusanspruch besteht — chk_bonusanspruch_art. */
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
import type { Bonusregelung } from "./types";
|
||||
|
||||
// VL und Bonusanspruch — zwei Vertragsangaben aus der Personalabteilung
|
||||
// (Migration 20261007100000).
|
||||
// FL und Bonusanspruch — zwei Vertragsangaben aus der Personalabteilung
|
||||
// (Migrationen 20261007100000 und, für die FL-Stufen, 20261201120000).
|
||||
// Gespeichert ist FL in der Spalte vl.
|
||||
//
|
||||
// Die Listen stehen dort als CHECK und hier für die Oberfläche;
|
||||
// tests/unit/vertragsangaben.test.ts hält beide gegeneinander, damit die
|
||||
// begründete Doppelung keine stille wird. Liefen sie auseinander, böte das
|
||||
// Formular einen Wert an, den die Datenbank abweist.
|
||||
|
||||
/** Die VL-Stufen 1 bis 8. Leer heisst „nicht erfasst" — es gibt keine Stufe 0. */
|
||||
export const VL_STUFEN: readonly number[] = [1, 2, 3, 4, 5, 6, 7, 8] as const;
|
||||
/** Die FL-Stufen 1 bis 7. Leer heisst „nicht erfasst" — es gibt keine Stufe 0. */
|
||||
export const VL_STUFEN: readonly number[] = [1, 2, 3, 4, 5, 6, 7] as const;
|
||||
|
||||
export const BONUSREGELUNGEN: readonly Bonusregelung[] = [
|
||||
"RL ab 01.01.2027",
|
||||
|
||||
@@ -14,16 +14,16 @@ describe("VertragsangabenFields", () => {
|
||||
expect(screen.getByLabelText(/Bonusregelung/)).toBeTruthy();
|
||||
});
|
||||
|
||||
it("steht bei Nein, ohne VL", () => {
|
||||
it("steht bei Nein, ohne FL", () => {
|
||||
render(<VertragsangabenFields value={LEER} onChange={() => {}} />);
|
||||
expect((screen.getByLabelText("Bonusanspruch") as HTMLSelectElement).value).toBe("nein");
|
||||
expect((screen.getByLabelText("VL") as HTMLSelectElement).value).toBe("");
|
||||
expect((screen.getByLabelText("FL") as HTMLSelectElement).value).toBe("");
|
||||
});
|
||||
|
||||
it("bietet VL 1 bis 8 und leer an", () => {
|
||||
it("bietet FL 1 bis 7 und leer an", () => {
|
||||
render(<VertragsangabenFields value={LEER} onChange={() => {}} />);
|
||||
const werte = [...(screen.getByLabelText("VL") as HTMLSelectElement).options].map((o) => o.value);
|
||||
expect(werte).toEqual(["", "1", "2", "3", "4", "5", "6", "7", "8"]);
|
||||
const werte = [...(screen.getByLabelText("FL") as HTMLSelectElement).options].map((o) => o.value);
|
||||
expect(werte).toEqual(["", "1", "2", "3", "4", "5", "6", "7"]);
|
||||
});
|
||||
|
||||
it("belegt bei Ja keine Regelung vor", () => {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { anzeige } from "@/lib/anzeige";
|
||||
import { KOLLEKTIVVERTRAEGE } from "@/lib/kollektivvertrag";
|
||||
import {
|
||||
BONUSREGELUNGEN,
|
||||
@@ -19,6 +20,7 @@ import {
|
||||
const migration = (datei: string) => readFileSync(join(process.cwd(), "db/migrations", datei), "utf8");
|
||||
const VERTRAG = migration("20261007100000_vl_bonus_zustaendige_hr.sql");
|
||||
const KV = migration("20261007090000_kollektivvertraege.sql");
|
||||
const FL = migration("20261201120000_fl_ohne_stufe_8.sql");
|
||||
|
||||
function werteDerBedingung(sql: string, name: string): string[] {
|
||||
const block = sql.match(new RegExp(`${name}\\s+check[\\s\\S]*?\\);`))?.[0];
|
||||
@@ -49,10 +51,18 @@ describe("Bonusregelungen", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("VL", () => {
|
||||
it("geht von 1 bis 8, wie in der Datenbank", () => {
|
||||
expect([...VL_STUFEN]).toEqual([1, 2, 3, 4, 5, 6, 7, 8]);
|
||||
expect(VERTRAG).toContain("vl is null or vl between 1 and 8");
|
||||
describe("FL", () => {
|
||||
it("geht von 1 bis 7, wie in der Datenbank", () => {
|
||||
expect([...VL_STUFEN]).toEqual([1, 2, 3, 4, 5, 6, 7]);
|
||||
expect(FL).toContain("vl is null or vl between 1 and 7");
|
||||
});
|
||||
|
||||
it("heisst in der Anzeige FL, auch als Feld der Historie", () => {
|
||||
expect(anzeige("VL")).toBe("FL");
|
||||
expect(anzeige("Geänderte Felder: VL, Bonusanspruch, wirksam ab 2026-12-01")).toBe(
|
||||
"Geänderte Felder: FL, Bonusanspruch, wirksam ab 01.12.2026"
|
||||
);
|
||||
expect(anzeige("VLB")).toBe("VLB");
|
||||
});
|
||||
|
||||
it("zeigt „–“, wenn nichts erfasst ist", () => {
|
||||
|
||||
Reference in New Issue
Block a user