175 |
175 |
if User.current.logged?
|
176 |
176 |
@available_filters["watcher_id"] = { :type => :list, :order => 15, :values => [["<< #{l(:label_me)} >>", "me"]] }
|
177 |
177 |
end
|
178 |
|
|
|
178 |
|
|
179 |
@available_filters["relation_blocked_issues"] = { :type => :integer, :order => 51 }
|
|
180 |
@available_filters["relation_blocking_issues"] = { :type => :integer, :order => 52 }
|
|
181 |
@available_filters["relation_preceded_issues"] = { :type => :integer, :order => 53 }
|
|
182 |
@available_filters["relation_preceding_issues"] = { :type => :integer, :order => 54 }
|
|
183 |
|
179 |
184 |
if project
|
180 |
185 |
# project specific filters
|
181 |
186 |
unless @project.issue_categories.empty?
|
... | ... | |
365 |
370 |
db_field = 'user_id'
|
366 |
371 |
sql << "#{Issue.table_name}.id #{ operator == '=' ? 'IN' : 'NOT IN' } (SELECT #{db_table}.watchable_id FROM #{db_table} WHERE #{db_table}.watchable_type='Issue' AND "
|
367 |
372 |
sql << sql_for_field(field, '=', v, db_table, db_field) + ')'
|
|
373 |
elsif field == "relation_blocked_issues"
|
|
374 |
sql << "
|
|
375 |
#{Issue.table_name}.id IN (
|
|
376 |
SELECT ir.issue_to_id
|
|
377 |
FROM issue_relations AS ir
|
|
378 |
LEFT OUTER JOIN issues AS i2 ON ir.issue_from_id = i2.id
|
|
379 |
LEFT OUTER JOIN issue_statuses AS is2 ON i2.status_id = is2.id
|
|
380 |
WHERE ir.relation_type='blocks'
|
|
381 |
AND is2.is_closed = FALSE
|
|
382 |
GROUP BY ir.issue_to_id
|
|
383 |
HAVING COUNT(*) >= 1
|
|
384 |
)"
|
|
385 |
elsif field == "relation_blocking_issues"
|
|
386 |
sql << "
|
|
387 |
#{Issue.table_name}.id IN (
|
|
388 |
SELECT ir.issue_from_id
|
|
389 |
FROM issue_relations AS ir
|
|
390 |
LEFT OUTER JOIN issues AS i2 ON ir.issue_from_id = i2.id
|
|
391 |
LEFT OUTER JOIN issue_statuses AS is2 ON i2.status_id = is2.id
|
|
392 |
WHERE ir.relation_type='blocks'
|
|
393 |
AND is2.is_closed = FALSE
|
|
394 |
GROUP BY ir.issue_to_id
|
|
395 |
HAVING COUNT(*) >= 1
|
|
396 |
)"
|
|
397 |
elsif field == "relation_preceded_issues"
|
|
398 |
sql << "
|
|
399 |
#{Issue.table_name}.id IN (
|
|
400 |
SELECT ir.issue_to_id
|
|
401 |
FROM issue_relations AS ir
|
|
402 |
LEFT OUTER JOIN issues AS i2 ON ir.issue_from_id = i2.id
|
|
403 |
LEFT OUTER JOIN issue_statuses AS is2 ON i2.status_id = is2.id
|
|
404 |
WHERE ir.relation_type='precedes'
|
|
405 |
AND is2.is_closed = FALSE
|
|
406 |
GROUP BY ir.issue_to_id
|
|
407 |
HAVING COUNT(*) >= 1
|
|
408 |
)"
|
|
409 |
elsif field == "relation_preceding_issues"
|
|
410 |
sql << "
|
|
411 |
#{Issue.table_name}.id IN (
|
|
412 |
SELECT ir.issue_from_id
|
|
413 |
FROM issue_relations AS ir
|
|
414 |
LEFT OUTER JOIN issues AS i2 ON ir.issue_from_id = i2.id
|
|
415 |
LEFT OUTER JOIN issue_statuses AS is2 ON i2.status_id = is2.id
|
|
416 |
WHERE ir.relation_type='precedes'
|
|
417 |
AND is2.is_closed = FALSE
|
|
418 |
GROUP BY ir.issue_to_id
|
|
419 |
HAVING COUNT(*) >= 1
|
|
420 |
)"
|
368 |
421 |
else
|
369 |
422 |
# regular field
|
370 |
423 |
db_table = Issue.table_name
|