Browse Source

Fixed issue #245 - No tag in conditions for new Overviews, Triggers, Schedulers and SLAs.

Rolf Schmidt 8 years ago
parent
commit
284d9e34b4
1 changed files with 5 additions and 2 deletions
  1. 5 2
      app/models/ticket.rb

+ 5 - 2
app/models/ticket.rb

@@ -580,7 +580,7 @@ condition example
         value = "%#{selector['value']}%"
         value = "%#{selector['value']}%"
         bind_params.push value
         bind_params.push value
       elsif selector['operator'] == 'contains all' && attributes[0] == 'ticket' && attributes[1] == 'tags'
       elsif selector['operator'] == 'contains all' && attributes[0] == 'ticket' && attributes[1] == 'tags'
-        query += "#{selector['value'].count} = (
+        query += "? = (
                                               SELECT
                                               SELECT
                                                 COUNT(*)
                                                 COUNT(*)
                                               FROM
                                               FROM
@@ -594,6 +594,7 @@ condition example
                                                 tag_items.id = tags.tag_item_id AND
                                                 tag_items.id = tags.tag_item_id AND
                                                 tag_items.name IN (?)
                                                 tag_items.name IN (?)
                                             )"
                                             )"
+        bind_params.push selector['value'].count
         bind_params.push selector['value']
         bind_params.push selector['value']
       elsif selector['operator'] == 'contains one' && attributes[0] == 'ticket' && attributes[1] == 'tags'
       elsif selector['operator'] == 'contains one' && attributes[0] == 'ticket' && attributes[1] == 'tags'
         query += "1 <= (
         query += "1 <= (
@@ -641,7 +642,9 @@ condition example
                       tag_objects.name = 'Ticket' AND
                       tag_objects.name = 'Ticket' AND
                       tag_items.id = tags.tag_item_id AND
                       tag_items.id = tags.tag_item_id AND
                       tag_items.name IN (?)
                       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']
         bind_params.push selector['value']
       elsif selector['operator'] == 'before (absolute)'
       elsif selector['operator'] == 'before (absolute)'
         query += "#{attribute} <= ?"
         query += "#{attribute} <= ?"