fix(core): free text's detector reads a dot, a longer run, a line break and invisible characters, and a reference takes nine digits
A dot joins an SSN's groups only when it joins both (000.00.0000), never an EIN's: a coordinate such as 47.6062095 is a number, not a tax id. A group that starts or ends inside a longer run of digits and dashes (a date's day then its reference, a part number) belongs to that run. A line break reads as a space and zero-width and soft-hyphen characters are not counted, as the strict party reading already has it. The reading is one detector with a parameter: a reference (tag, serial, invoice or payment reference, account code, label, where a W-9 or W-4 is kept) drops the bare-nine group, since a serial or a check number is nine digits. The engine now also refuses a payment's reference (printed shapes) and a discount's reason (free text), which only the tools' table covered; a payment entry's description, free text, shows the reference masked. A project's field has an engine-level test. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
657daf43da
commit
dd5f1befd6
8 files changed
+604
-78
No files matched your search
@@ -1008,6 +1008,13 @@ impl LedgerError {
|
||||
pub fn free_text(field: &str, text: &str) -> Result<(), LedgerError> {
|
||||
crate::settings::check_free_text(field, text).map_err(LedgerError::FreeTextHoldsTin)
|
||||
}
|
||||
|
||||
/// [`Self::free_text`] for a reference (a tag, a serial, a payment's or
|
||||
/// an invoice's reference, an account code, a file name): a bare nine
|
||||
/// digits is allowed ([`crate::settings::check_reference_text`]).
|
||||
pub fn reference_text(field: &str, text: &str) -> Result<(), LedgerError> {
|
||||
crate::settings::check_reference_text(field, text).map_err(LedgerError::FreeTextHoldsTin)
|
||||
}
|
||||
}
|
||||
|
||||
/// The refusal [`LedgerError::TaxCategoryRequired`] gives: what to pass,
|
||||
|
||||
Reference in new issue
Block a user