diff --git a/abrechenbarkeit.lua b/abrechenbarkeit.lua index dee8b4d..3291224 100755 --- a/abrechenbarkeit.lua +++ b/abrechenbarkeit.lua @@ -746,6 +746,17 @@ local function r_products_post() if barcode == nil or barcode:match(matchers_global.barcode) == nil then return error_box("{+error.invalid_barcode}") end + local exists = false + for _, a_barcode in read_barcodes() do + if a_barcode == barcode then + exists = true + end + end + + if exists then + return error_box("{+error.invalid_barcode}") + end + local barcodes = io.open("barcodes", "a+") if barcodes == nil then return error_box("{+error.open_barcodes}")