Project

General

Profile

Feature #2954 ยป redmine.duplicates.filter.patch

Nick Waggy, 2010-05-19 20:41

View differences:

config/locales/en.yml (working copy)
276 276
  field_content: Content
277 277
  field_group_by: Group results by
278 278
  field_sharing: Sharing
279
  field_relations_from: Duplicated by
279 280

  
280 281
  setting_app_title: Application title
281 282
  setting_app_subtitle: Application subtitle
app/models/query.rb (working copy)
195 195
    if User.current.logged?
196 196
      @available_filters["watcher_id"] = { :type => :list, :order => 15, :values => [["<< #{l(:label_me)} >>", "me"]] }
197 197
    end
198

  
198
    # filter out duplicates
199
    @available_filters["relations_from"] = { :type => :list, :order => 14, :values => [ ["none", "none"] ] }
200

  
199 201
    if project
200 202
      # project specific filters
201 203
      unless @project.issue_categories.empty?
......
395 397
        db_field = 'user_id'
396 398
        sql << "#{Issue.table_name}.id #{ operator == '=' ? 'IN' : 'NOT IN' } (SELECT #{db_table}.watchable_id FROM #{db_table} WHERE #{db_table}.watchable_type='Issue' AND "
397 399
        sql << sql_for_field(field, '=', v, db_table, db_field) + ')'
400
      elsif field == 'relations_from'
401
        # filter out duplicates
402
        db_table = IssueRelation.table_name
403
        db_field = 'issue_from_id'
404
        sql << "#{Issue.table_name}.id NOT IN (SELECT #{db_table}.issue_from_id from #{db_table} where relation_type='duplicates')"
398 405
      else
399 406
        # regular field
400 407
        db_table = Issue.table_name
    (1-1/1)