diff options
| author | Riley L. <riley@e926.de> | 2026-01-19 20:46:01 +0100 |
|---|---|---|
| committer | Riley L. <riley@e926.de> | 2026-01-19 20:46:01 +0100 |
| commit | edbd93c2c4bd5a01b369b044e9fb4e44fac9e798 (patch) | |
| tree | fe1646c30dd6dda7b75f37fbf35eb0245a1bbf87 | |
| parent | 394dc3477cf9bf26d1bba85724c23643b61a47af (diff) | |
| download | abrechenbarkeit-edbd93c2c4bd5a01b369b044e9fb4e44fac9e798.tar abrechenbarkeit-edbd93c2c4bd5a01b369b044e9fb4e44fac9e798.tar.bz2 abrechenbarkeit-edbd93c2c4bd5a01b369b044e9fb4e44fac9e798.tar.zst | |
add max_amount config field and functionality
| -rwxr-xr-x | abrechenbarkeit.lua | 7 | ||||
| -rw-r--r-- | locale/de.ini | 1 | ||||
| -rw-r--r-- | locale/en.ini | 1 | ||||
| -rw-r--r-- | readme.md | 1 |
4 files changed, 10 insertions, 0 deletions
diff --git a/abrechenbarkeit.lua b/abrechenbarkeit.lua index 5421d5a..2496a1b 100755 --- a/abrechenbarkeit.lua +++ b/abrechenbarkeit.lua @@ -385,6 +385,13 @@ local function r_transaction_post() local pcount = tonumber(data.pcount) local comment = data.comment local pname = data.pname + local max_amount = tonumber(config["max_amount"]) or 9999999999999 + + if math.abs(amount) > max_amount then + return error_box(format("{+error.invalid_amount} - {+max_amount}", { + amount = format_amount(math.abs(max_amount)), + })) + end if pname ~= nil or (pcode ~= nil and pcode ~= "") then -- check if barcode exists diff --git a/locale/de.ini b/locale/de.ini index c02c413..81b1221 100644 --- a/locale/de.ini +++ b/locale/de.ini @@ -81,3 +81,4 @@ error.unknown_barcode = Unbekannter Barcode error.open_new_barcodes = Öffnen der neuen Barcodes-Datei fehlgeschlagen error.open_barcodes = Öffnen der Barcodes-Datei fehlgeschlagen print = Drucken +max_amount = der maximale Betrag beträgt {amount} diff --git a/locale/en.ini b/locale/en.ini index 33f1516..00507af 100644 --- a/locale/en.ini +++ b/locale/en.ini @@ -82,3 +82,4 @@ users.embezzlement=A total of {amount} are currently under embezzlement. users.filter=Filter users.inactive_list=Inactive Users users=Users +max_amount=maximum amount for a single transaction is {amount} @@ -22,6 +22,7 @@ useful for development or proxyless deployments. - `unit`: unit used in the UI, e.g. €, $, EUR - `disable_balances`: disables showing user balances on `/`, they are still shown for SPUs, and on `/?users[&negative]` etc. - `disabled_balance_replacement`: only effective when `disable_balances` is set, text printed instead of balance, by default none at all; e.g. `<i>(hidden)</i>` + - `max_amount`: maximum transaction worth in cents (intended to stop accidental adding of EAN cents to balances; therefore default is "9"*12, the largest 12 digit number) ## Migration from Strichliste |