プロジェクト

全般

プロフィール

Vote #80730

完了

Export to PDF fails when subject of parent task is included in issue list

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
PDF export_39
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
39
version_id:
160
issue_org_id:
33103
author_id:
4
assigned_to_id:
332
comments:
6
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
127
ステータス-->[Closed]

説明

h1. Description

When choosing the subject of parent tasks to be displayed in the issue list, the pdf export fails and the user get's the "internal error" site presented.

h2. Log file output

ActionView::Template::Error (undefined method `parent.subject' for #
Did you mean?  parent_issue_id):
    1: <%= raw issues_to_pdf(@issues, @project, @query) %>

lib/redmine/export/pdf/issues_pdf_helper.rb:378:in `block in fetch_row_values'
lib/redmine/export/pdf/issues_pdf_helper.rb:372:in `collect'
lib/redmine/export/pdf/issues_pdf_helper.rb:372:in `fetch_row_values'
lib/redmine/export/pdf/issues_pdf_helper.rb:435:in `block in calc_col_width'
app/helpers/issues_helper.rb:31:in `block in issue_list'
app/helpers/issues_helper.rb:26:in `each'
app/helpers/issues_helper.rb:26:in `issue_list'
lib/redmine/export/pdf/issues_pdf_helper.rb:433:in `calc_col_width'
lib/redmine/export/pdf/issues_pdf_helper.rb:278:in `issues_to_pdf'
app/views/issues/index.pdf.erb:1:in `_26913a66e609d0514246c7dc3391de38'
lib/redmine/sudo_mode.rb:65:in `sudo_mode'

ActionView::Template::Error (undefined method `parent.subject' for #
Did you mean?  parent_issue_id):
    1: <%= raw issues_to_pdf(@issues, @project, @query) %>

lib/redmine/export/pdf/issues_pdf_helper.rb:378:in `block in fetch_row_values'
lib/redmine/export/pdf/issues_pdf_helper.rb:372:in `collect'
lib/redmine/export/pdf/issues_pdf_helper.rb:372:in `fetch_row_values'
lib/redmine/export/pdf/issues_pdf_helper.rb:435:in `block in calc_col_width'
app/helpers/issues_helper.rb:31:in `block in issue_list'
app/helpers/issues_helper.rb:26:in `each'
app/helpers/issues_helper.rb:26:in `issue_list'
lib/redmine/export/pdf/issues_pdf_helper.rb:433:in `calc_col_width'
lib/redmine/export/pdf/issues_pdf_helper.rb:278:in `issues_to_pdf'
app/views/issues/index.pdf.erb:1:in `_26913a66e609d0514246c7dc3391de38'
lib/redmine/sudo_mode.rb:65:in `sudo_mode'

The csv export of the same list works fine.


journals

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
This will be resolved with the following patch.

<pre><code class="diff">
diff --git a/lib/redmine/export/pdf/issues_pdf_helper.rb b/lib/redmine/export/pdf/issues_pdf_helper.rb
index 2f73e52a4..4b06fb87c 100644
--- a/lib/redmine/export/pdf/issues_pdf_helper.rb
+++ b/lib/redmine/export/pdf/issues_pdf_helper.rb
@@ -379,7 +379,11 @@ module Redmine
cv = issue.visible_custom_field_values.detect {|v| v.custom_field_id == column.custom_field.id}
show_value(cv, false)
else
- value = issue.send(column.name)
+ value = issue
+ column.name.to_s.split(/\./).each do |column_name|
+ value = value.__send__(column_name)
+ break unless value
+ end
case column.name
when :subject
value = " " * level + value
</code></pre>
--------------------------------------------------------------------------------
Yuichi HARADA, I think we can fix the issue by using the method @column.value_object(issue)@ instead of @issue.send()@. What do you think?

<pre><code class="diff">
diff --git a/lib/redmine/export/pdf/issues_pdf_helper.rb b/lib/redmine/export/pdf/issues_pdf_helper.rb
index 2f73e52a4..b49691695 100644
--- a/lib/redmine/export/pdf/issues_pdf_helper.rb
+++ b/lib/redmine/export/pdf/issues_pdf_helper.rb
@@ -379,7 +379,7 @@ module Redmine
cv = issue.visible_custom_field_values.detect {|v| v.custom_field_id == column.custom_field.id}
show_value(cv, false)
else
- value = issue.send(column.name)
+ value = column.value_object(issue)
case column.name
when :subject
value = " " * level + value
</code></pre>

I've added your test to this fix and it looks good on CI: https://gitlab.com/redmine-org/redmine/pipelines/128961861
--------------------------------------------------------------------------------
Marius BALTEANU wrote:
> Yuichi HARADA, I think we can fix the issue by using the method @column.value_object(issue)@ instead of @issue.send()@. What do you think?
>
> [...]
>
> I've added your test to this fix and it looks good on CI: https://gitlab.com/redmine-org/redmine/pipelines/128961861

I agree with you, I think it is correct. I didn't understand the method @QueryColumn#value_object@.
--------------------------------------------------------------------------------
Committed the patch. Thank you all for reporting and fixing the issue.
--------------------------------------------------------------------------------


related_issues

relates,Closed,19371,Add a new query column for the parent task subject

Admin Redmine さんが3年以上前に更新

  • カテゴリPDF export_39 にセット
  • 対象バージョン4.1.1_160 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0