From f3562cf44ec056281488ccadb78d87f86dbcfce5 Mon Sep 17 00:00:00 2001 From: "Riley L." Date: Mon, 30 Jun 2025 18:40:21 +0200 Subject: change name and name_opt regex to permit parentheses; replace 'prod-name' with 'barcode (prod-name)' in log field name when purchasing using barcode --- abrechenbarkeit.lua | 9 ++++++--- 1 file 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([[ -- cgit v1.2.3-70-g09d2