From 2fc804f61ac60d67f3cc1fb5852b0b757b64e410 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Wed, 23 Nov 2016 12:18:36 +0300 Subject: [PATCH] Add. Use params in call_block/index.lua (#2161) --- resources/install/scripts/app/call_block/index.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/resources/install/scripts/app/call_block/index.lua b/resources/install/scripts/app/call_block/index.lua index 3cdfc813ce..b2d6723225 100644 --- a/resources/install/scripts/app/call_block/index.lua +++ b/resources/install/scripts/app/call_block/index.lua @@ -111,7 +111,7 @@ This method causes the script to get its manadatory arguments directly from the found_enabled = rows["call_block_enabled"]; found_action = rows["call_block_action"]; found_count = rows["call_block_count"]; - end) + end) -- dbh:affected_rows() doesn't do anything if using core:db so this is the workaround: --set the cache @@ -176,7 +176,9 @@ This method causes the script to get its manadatory arguments directly from the k = k + 1 end if (source == "database") then - dbh:query("UPDATE v_call_block SET call_block_count = " .. found_count + 1 .. " WHERE call_block_uuid = '" .. found_uuid .. "'") + dbh:query("UPDATE v_call_block SET call_block_count = :call_block_count WHERE call_block_uuid = :call_block_uuid",{ + call_block_count = found_count + 1, call_block_uuid = found_uuid + }) end session:execute("set", "call_blocked=true"); logger("W", "NOTICE", "number " .. params["cid_num"] .. " blocked with " .. found_count .. " previous hits, domain_name: " .. params["domain_name"])