Project

General

Profile

Feature #9364 » limit_sub_issues-redmine-trunk.diff

Gilles Ballanger, 2011-10-02 11:28

View differences:

app/models/query.rb (working copy)
222 222
                           "start_date" => { :type => :date, :order => 11 },
223 223
                           "due_date" => { :type => :date, :order => 12 },
224 224
                           "estimated_hours" => { :type => :float, :order => 13 },
225
                           "done_ratio" =>  { :type => :integer, :order => 14 }}
225
                           "done_ratio" =>  { :type => :integer, :order => 14 },
226
                           "limit_sub_level" => { :type => :list, :order => 16, :values => ["0","1","2"]}}
226 227

  
227 228
    principals = []
228 229
    if project
......
632 633
    '(' + sql_for_field("assigned_to_id", operator, members_of_roles, Issue.table_name, "assigned_to_id", false) + ')'
633 634
  end
634 635

  
636
  def sql_for_limit_sub_level_field(field, operator, value)
637
    sql_for_field = "("
638
    v = value.to_s.to_i
639
    if v >= 0
640
      sql_for_field << "#{Issue.table_name}.parent_id IS NULL "
641
    end
642
    if v >= 1
643
      sql_for_field << "OR #{Issue.table_name}.parent_id IN" 
644
      sql_for_field << "( "
645
      sql_for_field << "SELECT #{Issue.table_name}.id "
646
      sql_for_field << "FROM #{Issue.table_name} "
647
      sql_for_field << "WHERE #{Issue.table_name}.parent_id IS NULL"
648
      sql_for_field << ")"
649
    end
650
    if v >= 2
651
      sql_for_field << "OR #{Issue.table_name}.parent_id IN" 
652
      sql_for_field << "( "
653
      sql_for_field << "SELECT #{Issue.table_name}.id "
654
      sql_for_field << "FROM #{Issue.table_name} "
655
      sql_for_field << "WHERE #{Issue.table_name}.parent_id IN"
656
      sql_for_field << "( "
657
      sql_for_field << "SELECT #{Issue.table_name}.id "
658
      sql_for_field << "FROM #{Issue.table_name} "
659
      sql_for_field << "WHERE #{Issue.table_name}.parent_id IS NULL"
660
      sql_for_field << ")"
661
      sql_for_field << ")"
662
    end
663
    sql_for_field << ")"
664
    sql_for_field
665
  end
666
  
635 667
  private
636 668

  
637 669
  def sql_for_custom_field(field, operator, value, custom_field_id)
config/locales/en-GB.yml (working copy)
311 311
  field_text: Text field
312 312
  field_visible: Visible
313 313
  field_warn_on_leaving_unsaved: "Warn me when leaving a page with unsaved text"
314
  field_limit_sub_level: Sub issues limit
314 315
  
315 316
  setting_app_title: Application title
316 317
  setting_app_subtitle: Application subtitle
config/locales/en.yml (working copy)
315 315
  field_root_directory: Root directory
316 316
  field_cvsroot: CVSROOT
317 317
  field_cvs_module: Module
318
  field_limit_sub_level: Sub issues limit
318 319

  
319 320
  setting_app_title: Application title
320 321
  setting_app_subtitle: Application subtitle
config/locales/fr.yml (working copy)
315 315
  field_issues_visibility: Visibilité des demandes
316 316
  field_is_private: Privée
317 317
  field_commit_logs_encoding: Encodage des messages de commit
318

  
318
  field_limit_sub_level: Limite de sous tâche
319
  
319 320
  setting_app_title: Titre de l'application
320 321
  setting_app_subtitle: Sous-titre de l'application
321 322
  setting_welcome_text: Texte d'accueil
(2-2/2)