summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-10-03 21:36:19 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-10-03 21:36:19 +0000
commit0178b5a2fe07e1160348b99ac56c19ebf154ca1b (patch)
tree53f762a779c95b598815864bb674463d90ef64d6 /lib
parentbb1563f23ffabcf948797e0d8806c3d5344d09a7 (diff)
downloadredmine-0178b5a2fe07e1160348b99ac56c19ebf154ca1b.tar.gz
redmine-0178b5a2fe07e1160348b99ac56c19ebf154ca1b.zip
Private issue notes (#1554).
Adds 2 new permissions for viewing/adding private comments to issues. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10547 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine.rb2
-rw-r--r--lib/redmine/default_data/loader.rb2
-rw-r--r--lib/redmine/export/pdf.rb45
3 files changed, 25 insertions, 24 deletions
diff --git a/lib/redmine.rb b/lib/redmine.rb
index 0459dcc50..e120aa802 100644
--- a/lib/redmine.rb
+++ b/lib/redmine.rb
@@ -78,6 +78,8 @@ Redmine::AccessControl.map do |map|
map.permission :add_issue_notes, {:issues => [:edit, :update], :journals => [:new], :attachments => :upload}
map.permission :edit_issue_notes, {:journals => :edit}, :require => :loggedin
map.permission :edit_own_issue_notes, {:journals => :edit}, :require => :loggedin
+ map.permission :view_private_notes, {}, :read => true, :require => :member
+ map.permission :set_notes_private, {}, :require => :member
map.permission :move_issues, {:issues => [:bulk_edit, :bulk_update]}, :require => :loggedin
map.permission :delete_issues, {:issues => :destroy}, :require => :member
# Queries
diff --git a/lib/redmine/default_data/loader.rb b/lib/redmine/default_data/loader.rb
index eabc35161..a91f6e22c 100644
--- a/lib/redmine/default_data/loader.rb
+++ b/lib/redmine/default_data/loader.rb
@@ -53,6 +53,8 @@ module Redmine
:view_issues,
:add_issues,
:edit_issues,
+ :view_private_notes,
+ :set_notes_private,
:manage_issue_relations,
:manage_subtasks,
:add_issue_notes,
diff --git a/lib/redmine/export/pdf.rb b/lib/redmine/export/pdf.rb
index e821c4e8a..e554144e2 100644
--- a/lib/redmine/export/pdf.rb
+++ b/lib/redmine/export/pdf.rb
@@ -495,7 +495,7 @@ module Redmine
end
# Returns a PDF string of a single issue
- def issue_to_pdf(issue)
+ def issue_to_pdf(issue, assoc={})
pdf = ITCPDF.new(current_language)
pdf.SetTitle("#{issue.project} - #{issue.tracker} ##{issue.id}")
pdf.alias_nb_pages
@@ -642,31 +642,28 @@ module Redmine
end
end
- pdf.SetFontStyle('B',9)
- pdf.RDMCell(190,5, l(:label_history), "B")
- pdf.Ln
- indice = 0
- for journal in issue.journals.find(
- :all, :include => [:user, :details],
- :order => "#{Journal.table_name}.created_on ASC")
- indice = indice + 1
- pdf.SetFontStyle('B',8)
- pdf.RDMCell(190,5,
- "#" + indice.to_s +
- " - " + format_time(journal.created_on) +
- " - " + journal.user.name)
+ if assoc[:journals].present?
+ pdf.SetFontStyle('B',9)
+ pdf.RDMCell(190,5, l(:label_history), "B")
pdf.Ln
- pdf.SetFontStyle('I',8)
- details_to_strings(journal.details, true).each do |string|
- pdf.RDMMultiCell(190,5, "- " + string)
- end
- if journal.notes?
- pdf.Ln unless journal.details.empty?
- pdf.SetFontStyle('',8)
- pdf.RDMwriteHTMLCell(190,5,0,0,
- journal.notes.to_s, issue.attachments, "")
+ assoc[:journals].each do |journal|
+ pdf.SetFontStyle('B',8)
+ title = "##{journal.indice} - #{format_time(journal.created_on)} - #{journal.user}"
+ title << " (#{l(:field_private_notes)})" if journal.private_notes?
+ pdf.RDMCell(190,5, title)
+ pdf.Ln
+ pdf.SetFontStyle('I',8)
+ details_to_strings(journal.details, true).each do |string|
+ pdf.RDMMultiCell(190,5, "- " + string)
+ end
+ if journal.notes?
+ pdf.Ln unless journal.details.empty?
+ pdf.SetFontStyle('',8)
+ pdf.RDMwriteHTMLCell(190,5,0,0,
+ journal.notes.to_s, issue.attachments, "")
+ end
+ pdf.Ln
end
- pdf.Ln
end
if issue.attachments.any?