Preisregel im Brief, Preispruefung in Workflow 2

This commit is contained in:
2026-09-20 12:46:06 +02:00
parent 316d82d499
commit 45d28afe9b

View File

@@ -80,7 +80,7 @@ KONF = node("Konfiguration", "n8n-nodes-base.set", 3.4, [-240, 200], {
{"id": nid(), "name": "nw_project", "value": "3da4d745e0e223cb", "type": "string"},
{"id": nid(), "name": "nw_engine", "value": "google.de", "type": "string"},
{"id": nid(), "name": "nw_language", "value": "German", "type": "string"},
{"id": nid(), "name": "gitea_base", "value": "https://gitea.lucas-orth.de", "type": "string"},
{"id": nid(), "name": "gitea_base", "value": "http://gitea:3000", "type": "string"},
{"id": nid(), "name": "gitea_owner", "value": "lucas.orth", "type": "string"},
{"id": nid(), "name": "gitea_repo", "value": "Skrift-Auto-Article", "type": "string"},
{"id": nid(), "name": "branch", "value": "main", "type": "string"},
@@ -296,6 +296,20 @@ const brief = {
terms_txt_content_basic: ((n.terms_txt || {}).content_basic_w_ranges) ?? null,
},
schreibregeln: {
preise: 'Preise niemals ausschreiben. Immer den Shortcode einsetzen: '
+ '[skrift_preis key="SCHLUESSEL" ab="0|1" brutto="0|1"]. '
+ 'key ist der Produktschluessel (z. B. briefe, postkarten, porto_inland). '
+ 'ab=1 liefert den guenstigsten Staffelpreis, ab=0 den Standardpreis. '
+ 'brutto=1 inkl. MwSt., brutto=0 netto. Das Wort "ab" selbst gehoert in den Fliesstext, '
+ 'der Shortcode liefert nur die Zahl. Beispiel: '
+ 'Handschriftliche Briefe ab [skrift_preis key="briefe" ab="1"] pro Stueck. '
+ 'Ein unbekannter key ergibt eine leere Ausgabe, keinen Fehler.',
faq: 'FAQ nicht in content_html schreiben, sondern als Feld faq mit Frage-Antwort-Paaren. '
+ 'Die Ausgabe im Beitrag uebernimmt der Shortcode [skrift_faq].',
kurzantwort: 'Ein Absatz, der die Hauptfrage direkt beantwortet, als eigenes Feld kurzantwort.',
},
meta: {
erzeugt_am: new Date().toISOString(),
analyse_url: n.query_url || a.query_url || null,
@@ -318,7 +332,10 @@ link(BRIEF, PRUEF)
COMMIT_VOR = code("Commit vorbereiten", [2660, 300], """
const b = $('Brief bauen').first().json;
const p = $input.first().json;
const vorhanden = p.statusCode === 200 && p.body && p.body.sha;
// n8n liefert den Koerper bei fullResponse je nach Version als body oder data.
const K = (r) => (r && r.body !== undefined) ? r.body : ((r || {}).data);
const kp = K(p);
const vorhanden = p.statusCode === 200 && kp && kp.sha;
const inhalt = Buffer.from(JSON.stringify(b.brief, null, 2), 'utf8').toString('base64');
const konf = $('Konfiguration').first().json;
@@ -331,7 +348,7 @@ return [{ json: {
content: inhalt,
message: `Brief ${vorhanden ? 'aktualisiert' : 'erzeugt'}: ${b.slug} (${b.keyword})`,
branch: konf.branch,
...(vorhanden ? { sha: p.body.sha } : {}),
...(vorhanden ? { sha: kp.sha } : {}),
}),
}}];
""")