Arbeitszeit: Zeitbuchungen anlegen, aendern und loeschen

createZeitbuchung, updateZeitbuchung und deleteZeitbuchung buchen
Taetigkeitsbloecke und Pausen ueber module/arbeitszeit/api/. Die erste
Buchung eines Tages legt per nachtragen.php die Schicht an, weitere
Buchungen kommen in die vorhandene Schicht, die bei Bedarf verlaengert
wird. Die Kostenstelle wird an die Notiz gehaengt. Unbekannte
Taetigkeiten werden vorher abgelehnt, weil Agrarmonitor sie ohne Fehler
speichert. Ablehnungen kommen als ZeitbuchungError mit Grund.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bjoernpoettkerandClaude Opus 5.5 committed 2026-10-14 11:42:57 +02:00
1 parent 6db6c5b278
commit d703e46125
21 files changed
+1920 -16

No files matched your search

+4
View File
@@ -105,4 +105,8 @@ The store can read both the connector format and the older Telefonbuch cookie-ar
- `getMitarbeiter(suchstring?, mitarbeitergruppe?)` reads `/module/mitarbeiter/livesearch.php` and returns employee ID, number, last name, first name, and active flag.
- `getTaetigkeiten()` reads `/module/arbeitszeit/taetigkeiten-livesearch.php` (active and inactive) and returns activity ID, UUID, number, name, active flag, area (`bereichId`, `bereich`) and the flags `maschineZuordnen`, `abwesenheit`, `notizErzwingen`.
- Agrarmonitor has no cost center master data (`Kostenstelle` is only a free-text field on machines, employees and articles), so there is no `getKostenstellen()`. See `docs/zeitbuchung-analyse.md`.
- `createZeitbuchung(daten)` books an activity block (`taetigkeitId`, optional `maschinenId`, `notiz`, `kostenstelle`) or a break (`art: 'pause'`) for `mitarbeiterId` from `start` to `ende` (minute precision, Europe/Berlin) and returns `{ ref }`. The first booking of a day creates the shift via `nachtragen.php`; later bookings go into the existing shift, which is extended if needed. Breaks need an existing shift. Agrarmonitor has no cost center field, so `kostenstelle` is appended to the note as `Kostenstelle: …`. Pass `datum` (YYYY-MM-DD) for blocks after midnight that belong to the previous workday.
- `updateZeitbuchung(ref, daten)` changes times, activity, machine and note of a booking (the old note is replaced); changing the type (activity/break), employee or workday is rejected.
- `deleteZeitbuchung(ref)` deletes a booking; deleting the last activity of a shift also deletes the shift in Agrarmonitor.
- Refs look like `verteilung:<mitarbeiterId>:<YYYY-MM-DD>:<id>` or `pause:…`. Rejections by Agrarmonitor (HTTP 4xx such as 422 with the reason in the body) and invalid input throw `ZeitbuchungError` (`grund`, `status`); network and 5xx errors are thrown unchanged so callers can retry.
- `saveSession()` explicitly persists the current cookie jar.