From 7b345b87955582bcf0b64dd3e9e2055cb5a09249 Mon Sep 17 00:00:00 2001 From: Hans Wienen Date: Sun, 5 Jul 2026 22:28:36 +0200 Subject: [PATCH] Add standalone dynamic invoice Sieve rule The prompts used to arrive at this change since the previous commit User reported the Dynamisch kwartaal Roundcube filter is empty and asked for a new file containing a dynamic invoice-quarter filter while keeping the rest of the plan approved. Any special observations that may be relevant for version management for this version. Be brief. invoice_dynamic_quarter.sieve uses Date header year capture plus regex month tests and compiles with sievec. Existing untracked financ.sieve, codex.session, roundcube.txt, plan.md, and verplaats_log.json were left untouched. --- invoice_dynamic_quarter.sieve | 40 +++++++++++++++++++++++++++++++++++ restart_prompt.md | 1 + 2 files changed, 41 insertions(+) create mode 100644 invoice_dynamic_quarter.sieve diff --git a/invoice_dynamic_quarter.sieve b/invoice_dynamic_quarter.sieve new file mode 100644 index 0000000..608be52 --- /dev/null +++ b/invoice_dynamic_quarter.sieve @@ -0,0 +1,40 @@ +# invoice_dynamic_quarter.sieve +# Single Roundcube/Managesieve rule for dynamic invoice quarter routing. +# Import this as a standalone filter set or copy the rule into an existing set. + +require ["fileinto", "date", "variables", "regex"]; + +# rule:[Financieel / Facturen / Dynamisch kwartaal] +if allof ( + header :contains "Subject" [ + "factuur", + "invoice", + "rekening", + "nota", + "betaalverzoek", + "receipt", + "orderbevestiging", + "order confirmation", + "betaling ontvangen", + "payment received", + "uw factuur", + "your invoice", + "je factuur" + ], + date :matches "Date" "year" "*" +) { + set "jaar" "${1}"; + + if date :regex "Date" "month" "^(0?[123])$" { + set "kwartaal" "Q1"; + } elsif date :regex "Date" "month" "^(0?[456])$" { + set "kwartaal" "Q2"; + } elsif date :regex "Date" "month" "^(0?[789])$" { + set "kwartaal" "Q3"; + } else { + set "kwartaal" "Q4"; + } + + fileinto "INBOX.Financieel.Facturen.${jaar}.${kwartaal}"; + stop; +} diff --git a/restart_prompt.md b/restart_prompt.md index 603b0ad..2807170 100644 --- a/restart_prompt.md +++ b/restart_prompt.md @@ -70,6 +70,7 @@ Logs/state kept: Roundcube/Sieve: - `mailcat_roundcube.sieve` is the generated Roundcube/Managesieve Sieve file for the current routing setup. +- `invoice_dynamic_quarter.sieve` is a standalone Roundcube/Managesieve Sieve file containing only the dynamic invoice-quarter rule. It uses the message `Date` header to set `jaar`, regex month tests to set `kwartaal`, then files into `INBOX.Financieel.Facturen.${jaar}.${kwartaal}`. - It uses `INBOX.`-prefixed mailbox names because the user's Roundcube export used `fileinto :copy "INBOX.Notes";`. - It includes `Afmelden.*` routes and uses `fileinto` without `:copy`, so matching incoming messages are sorted instead of duplicated. - Rules have Roundcube-compatible `# rule:[...]` names.