Aufträge: Konfiguration und Pilot-Schalter AUFTRAEGE_ENABLED
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0ab3cbbaa3
commit
ddffc7a92d
3 files changed
+135
No files matched your search
@@ -0,0 +1,21 @@
|
||||
import { config } from '../../config.js'
|
||||
|
||||
/**
|
||||
* Pilot-Schalter der Aufträge (AUFTRAEGE_ENABLED = off (Vorgabe) | pilot | on). Betrifft nur die AB-Funktionen und
|
||||
* die Rechnungsarten anzahlung/schluss; Projektkonto und die Arten frei, festbetrag, aufwand laufen immer.
|
||||
* Liest config.auftraege bei jedem Aufruf.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Darf dieser Kunde Auftragsbestätigungen nutzen? `kunde`: Kundendokument oder { email }. on = alle; pilot = Liste
|
||||
* enthält '*' oder die (klein geschriebene, getrimmte) E-Mail-Adresse steht in AUFTRAEGE_PILOT_EMAILS (eine leere
|
||||
* Liste lässt niemanden durch); alles andere, auch ein unbekannter Modus, gilt als off.
|
||||
*/
|
||||
export function auftraegeAktiv(kunde) {
|
||||
const { mode, pilotEmails } = config.auftraege
|
||||
if (mode === 'on') return true
|
||||
if (mode !== 'pilot') return false
|
||||
if (pilotEmails.includes('*')) return true
|
||||
const adresse = String(kunde?.email || '').trim().toLowerCase()
|
||||
return adresse !== '' && pilotEmails.includes(adresse)
|
||||
}
|
||||
Reference in new issue
Block a user