diff options
author | Riley L. <riley@e926.de> | 2025-06-30 18:40:21 +0200 |
---|---|---|
committer | Riley L. <riley@e926.de> | 2025-06-30 18:40:21 +0200 |
commit | f3562cf44ec056281488ccadb78d87f86dbcfce5 (patch) | |
tree | a9da51cbad1e4d6641671fa58247b1274e068100 | |
parent | 7ac7c43ccdb102f7e11a92a1320e6ce6a0c6b7ca (diff) | |
download | abrechenbarkeit-f3562cf44ec056281488ccadb78d87f86dbcfce5.tar abrechenbarkeit-f3562cf44ec056281488ccadb78d87f86dbcfce5.tar.bz2 abrechenbarkeit-f3562cf44ec056281488ccadb78d87f86dbcfce5.tar.zst |
change name and name_opt regex to permit parentheses; replace 'prod-name' with 'barcode (prod-name)' in log field name when purchasing using barcode
-rwxr-xr-x | abrechenbarkeit.lua | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/abrechenbarkeit.lua b/abrechenbarkeit.lua index 032e10d..cb9f30e 100755 --- a/abrechenbarkeit.lua +++ b/abrechenbarkeit.lua @@ -29,8 +29,8 @@ local matchers = { comment_opt = "([%w_ -]*)", barcode = "([%w_-]+)", barcode_opt = "([%w_-]*)", - name = "([%w_ -]+)", - name_opt = "([%w_ -]*)", + name = "([%w%_% %-%(%)]+)", + name_opt = "([%w%_% %-%(%)]*)", } local matchers_global = (function() local s = {} @@ -432,7 +432,10 @@ local function r_transaction_post() end local time = os.time() log:write(string.format("%d,%s,%s,%d,%s,%s,%s\n", - time, user_src, user_dst, amount, pname or "", pcount or "", comment)) + time, user_src, user_dst, amount, + pcode and (pcode .. (pname and " (" .. pname .. ")" or "")) or (pname or ""), + pcount or "", + comment)) log:flush() log:close() return format([[ |