AVV Webshop, Vorbemerkung Abs. 2: Das Team darf den Webshop ohne Online-Bestellung
nur einschalten, wenn der Kunde vorher in Textform zugestimmt hat. Die Textform-Aktivierung
gilt jetzt wie beim Terminplaner auch fuer 'shop' (Modus on, Pilotadressen ausgenommen,
shopTextformNoetig): Nachweis in featureConsents mit Fassung (config.shop.fassung), Datum,
Weg, Mitarbeiter und dem Wortlaut der Erklaerungen der Bestelltexte, K16 mit
Leistungsbeschreibung und AVV als PDF. GET /api/team/funktionen/:kunde liefert zusaetzlich
shop { textformNoetig, avvVersion, links }.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
40 lines
1.6 KiB
JavaScript
40 lines
1.6 KiB
JavaScript
import { config } from '../../config.js'
|
|
|
|
/**
|
|
* Webshop-Schalter (Funktionsschluessel 'shop'): SHOP_ENABLED = off (Vorgabe) | pilot | on.
|
|
* Liest config.shop bei jedem Aufruf. Bei off laufen keine Shop-Jobs und keine Shop-Abfragen.
|
|
*/
|
|
|
|
/** 'off' | 'pilot' | 'on'; alles andere (leer, unbekannt) gilt als off. */
|
|
export function shopModus() {
|
|
const mode = config.shop.mode
|
|
return mode === 'pilot' || mode === 'on' ? mode : 'off'
|
|
}
|
|
|
|
/**
|
|
* Darf dieser Kunde den Webshop nutzen? pilot = nur Adressen aus SHOP_PILOT_EMAILS ('*' = alle; eine leere
|
|
* Liste laesst niemanden durch); on = alle Kunden; off = niemand.
|
|
*/
|
|
export function shopFuerKunde(email) {
|
|
const modus = shopModus()
|
|
if (modus === 'off') return false
|
|
if (modus === 'on') return true
|
|
const erlaubt = config.shop.pilotEmails
|
|
if (erlaubt.includes('*')) return true
|
|
const adresse = String(email || '').trim().toLowerCase()
|
|
return adresse !== '' && erlaubt.includes(adresse)
|
|
}
|
|
|
|
/**
|
|
* Verlangt die Aktivierung durch das Team (WOMS, ohne Bestellung) die Zustimmung des Kunden in Textform (AVV Webshop,
|
|
* Vorbemerkung Abs. 2)? Wie beim Terminplaner (termineTextformNoetig): nur im Modus on und nur, wenn die Adresse des Kunden nicht
|
|
* in SHOP_PILOT_EMAILS steht. '*' ist keine Pilotadresse und befreit niemanden. In off und pilot sprechen Mitarbeiter und Kunde
|
|
* direkt miteinander (Pilotbetrieb).
|
|
*/
|
|
export function shopTextformNoetig(email) {
|
|
if (shopModus() !== 'on') return false
|
|
const adresse = String(email || '').trim().toLowerCase()
|
|
if (adresse === '' || adresse === '*') return true
|
|
return !config.shop.pilotEmails.includes(adresse)
|
|
}
|