diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-01-25 19:32:07 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-01-25 19:32:07 +0000 |
commit | e2e111f95ebb5f5c0803ddfe8b54ca4fdf4dd921 (patch) | |
tree | 611f3f20f1e4b8bac47335b273bc4e6433d413b5 /app | |
parent | 8985d05a6636666657f88d2ff9276c12b413e150 (diff) | |
download | redmine-e2e111f95ebb5f5c0803ddfe8b54ca4fdf4dd921.tar.gz redmine-e2e111f95ebb5f5c0803ddfe8b54ca4fdf4dd921.zip |
* added missing fields to csv export: priority, start date, due date, done ratio
git-svn-id: http://redmine.rubyforge.org/svn/trunk@177 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects_controller.rb | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 165333e78..3979d7f64 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -15,6 +15,8 @@ # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+require 'csv'
+
class ProjectsController < ApplicationController
layout 'base'
before_filter :find_project, :authorize, :except => [ :index, :list, :add ]
@@ -255,21 +257,41 @@ class ProjectsController < ApplicationController render :action => 'list_issues' and return unless @query.valid?
@issues = Issue.find :all, :order => sort_clause,
- :include => [ :author, :status, :tracker, :project, :custom_values ],
- :conditions => @query.statement
+ :include => [ :author, :status, :tracker, :priority, {:custom_values => :custom_field} ],
+ :conditions => @query.statement
ic = Iconv.new('ISO-8859-1', 'UTF-8')
export = StringIO.new
CSV::Writer.generate(export, l(:general_csv_separator)) do |csv|
# csv header fields
- headers = [ "#", l(:field_status), l(:field_tracker), l(:field_subject), l(:field_author), l(:field_created_on), l(:field_updated_on) ]
+ headers = [ "#", l(:field_status),
+ l(:field_tracker),
+ l(:field_priority),
+ l(:field_subject),
+ l(:field_author),
+ l(:field_start_date),
+ l(:field_due_date),
+ l(:field_done_ratio),
+ l(:field_created_on),
+ l(:field_updated_on)
+ ]
for custom_field in @project.all_custom_fields
headers << custom_field.name
end
csv << headers.collect {|c| ic.iconv(c) }
# csv lines
@issues.each do |issue|
- fields = [issue.id, issue.status.name, issue.tracker.name, issue.subject, issue.author.display_name, l_datetime(issue.created_on), l_datetime(issue.updated_on)]
+ fields = [issue.id, issue.status.name,
+ issue.tracker.name,
+ issue.priority.name,
+ issue.subject,
+ issue.author.display_name,
+ issue.start_date ? l_date(issue.start_date) : nil,
+ issue.due_date ? l_date(issue.due_date) : nil,
+ issue.done_ratio,
+ l_datetime(issue.created_on),
+ l_datetime(issue.updated_on)
+ ]
for custom_field in @project.all_custom_fields
fields << (show_value issue.custom_value_for(custom_field))
end
|