From 284d9e34b4731521f49c02a59c0417abac76d41e Mon Sep 17 00:00:00 2001 From: Rolf Schmidt Date: Wed, 12 Apr 2017 16:27:00 +0200 Subject: [PATCH] Fixed issue #245 - No tag in conditions for new Overviews, Triggers, Schedulers and SLAs. --- app/models/ticket.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/models/ticket.rb b/app/models/ticket.rb index 7fb4f8754..a56574cf4 100644 --- a/app/models/ticket.rb +++ b/app/models/ticket.rb @@ -580,7 +580,7 @@ condition example value = "%#{selector['value']}%" bind_params.push value elsif selector['operator'] == 'contains all' && attributes[0] == 'ticket' && attributes[1] == 'tags' - query += "#{selector['value'].count} = ( + query += "? = ( SELECT COUNT(*) FROM @@ -594,6 +594,7 @@ condition example tag_items.id = tags.tag_item_id AND tag_items.name IN (?) )" + bind_params.push selector['value'].count bind_params.push selector['value'] elsif selector['operator'] == 'contains one' && attributes[0] == 'ticket' && attributes[1] == 'tags' query += "1 <= ( @@ -641,7 +642,9 @@ condition example tag_objects.name = 'Ticket' AND tag_items.id = tags.tag_item_id AND tag_items.name IN (?) - ) BETWEEN ( #{selector['value'].count} - 1 ) AND #{selector['value'].count}" + ) BETWEEN ? AND ?" + bind_params.push selector['value'].count - 1 + bind_params.push selector['value'].count bind_params.push selector['value'] elsif selector['operator'] == 'before (absolute)' query += "#{attribute} <= ?"