Go to content Go to navigation Go to search

Redmine、作業時間のレポートで指定する条件を増やしてみた。

12月 3rd, 2012 by mattari

Redmine の工数管理機能のレポートを使うと、いろんな条件で工数集計ができます。

しかし、標準だと指定できる条件が3つまでに限定されているので、報告内容によっては少し条件が足りないことがあります。そこで、指定できる条件を4つに増やしてみました。

標準だと条件は3つまで。

4つめの条件を指定可能に。

キャプチャ2

修正方法は以下です。

Redmine2.x の場合、

 

Index: <REDMIE_ROOT>/app/views/timelog/report.html.erb
=======================================================
@@ -24,7 +24,7 @@
                                                           :onchange => "this.form.submit();",
                                                           :style => ‘width: 200px’,
                                                           :id => nil,
-                                                          :disabled => (@report.criteria.length >= 3), :id => "criterias") %>
+                                                          :disabled => (@report.criteria.length >= 4), :id => "criterias") %>
      <%= link_to l(:button_clear), {:project_id => @project, :issue_id => @issue, :period_type => params[:period_type], :period => params[:period], :from => @from, :to => @to, :columns => @report.columns}, :class => ‘icon icon-reload’ %></p>
<% end %>
 
Index: <REDMINE_ROOT>/lib/redmine/helpers/time_report.rb
====================================================
@@ -27,7 +27,7 @@
         @criteria = criteria || []
         @criteria = @criteria.select{|criteria| available_criteria.has_key? criteria}
         @criteria.uniq!
-        @criteria = @criteria[0,3]
+        @criteria = @criteria[0,4]
 
         @columns = (columns && %w(year month week day).include?(columns)) ? columns : ‘month’
         @from = from

 

Redmine1.x の場合

Index: <REDMINE_ROOT>/app/controllers/time_entry_reports_controller.rb
====================================================
@@ -15,7 +15,7 @@
     @criterias = params[:criterias] || []
     @criterias = @criterias.select{|criteria| @available_criterias.has_key? criteria}
     @criterias.uniq!
-    @criterias = @criterias[0,3]
+    @criterias = @criterias[0,4]
    
     @columns = (params[:columns] && %w(year month week day).include?(params[:columns])) ? params[:columns] : ‘month’
    
Index: <REDMINE_ROOT>/app/views/time_entry_reports/report.rhtml
====================================================
@@ -22,7 +22,7 @@
                                                           :onchange => "this.form.submit();",
                                                           :style => ‘width: 200px’,
                                                           :id => nil,
-                                                          :disabled => (@criterias.length >= 3)) %>
+                                                          :disabled => (@criterias.length >= 4)) %>
      <%= link_to l(:button_clear), {:project_id => @project, :issue_id => @issue, :period_type => params[:period_type], :period => params[:period], :from => @from, :to => @to, :columns => @columns}, :class => ‘icon icon-reload’ %></p>
<% end %> 
 

修正後、Redmineを再起動すれば反映されます。

 

 

Leave a Reply

関連記事