]> source.dussan.org Git - redmine.git/commitdiff
Merged r3333 from trunk.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 18 Jan 2010 18:01:19 +0000 (18:01 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 18 Jan 2010 18:01:19 +0000 (18:01 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3334 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/issues_controller.rb
lib/redmine/export/pdf.rb
test/functional/issues_controller_test.rb

index 71e07ce0960236d5a99d4ac5529696c9d3f675dd..d2e7b5aaa401c41673e97f9f083dc99dc5ac0c68 100644 (file)
@@ -40,6 +40,7 @@ class IssuesController < ApplicationController
   helper :attachments
   include AttachmentsHelper
   helper :queries
+  include QueriesHelper
   helper :sort
   include SortHelper
   include IssuesHelper
index 5242cb37f9e514000cff218b19c16104fbaf3ba0..c80880afa4094b1cbb7495174b2055a01738f112 100644 (file)
@@ -144,13 +144,15 @@ module Redmine
         # rows
         pdf.SetFontStyle('',8)
         pdf.SetFillColor(255, 255, 255)
-        group = false
+        previous_group = false
         issues.each do |issue|
-          if query.grouped? && issue.send(query.group_by) != group
-            group = issue.send(query.group_by)
+          if query.grouped? && (group = query.group_by_column.value(issue)) != previous_group
             pdf.SetFontStyle('B',9)
-            pdf.Cell(277, row_height, "#{group.blank? ? 'None' : group.to_s}", 1, 1, 'L')
+            pdf.Cell(277, row_height, 
+              (group.blank? ? 'None' : group.to_s) + " (#{@issue_count_by_group[group]})",
+              1, 1, 'L')
             pdf.SetFontStyle('',8)
+            previous_group = group
           end
           pdf.Cell(15, row_height, issue.id.to_s, 1, 0, 'L', 1)
           query.columns.each_with_index do |column, i|
index 8a0c4e884d6e9d3638349e2a647abe48d4bc8c01..14c20bbbdde07e9a71859d8f84383e90d9bdc605 100644 (file)
@@ -236,6 +236,14 @@ class IssuesControllerTest < ActionController::TestCase
     assert_equal 'application/pdf', @response.content_type
   end
   
+  def test_index_pdf_with_query_grouped_by_list_custom_field
+    get :index, :project_id => 1, :query_id => 9, :format => 'pdf'
+    assert_response :success
+    assert_not_nil assigns(:issues)
+    assert_not_nil assigns(:issue_count_by_group)
+    assert_equal 'application/pdf', @response.content_type
+  end
+  
   def test_index_sort
     get :index, :sort => 'tracker,id:desc'
     assert_response :success