Project

General

Profile

Actions

Defect #33169

closed

Issues CSV export does not include custom fields with "Full width layout" enabled

Added by Go MAEDA about 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Issues
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

Steps to reproduce:

1. Add a long text custom field with "Full width layout" enabled
2. Export issues to CSV. The CSV file does not include the custom field
3. Disable "Full width layout" for the custom field
4. Export issues to CSV. You can see the field in the CSV


Files


Related issues

Related to Redmine - Feature #26081: Allow full_width_layout long-text custom fields to appear in the issue list like 'Description' (as a block column)ClosedGo MAEDA

Actions
Related to Redmine - Patch #33211: Include block columns (ex: Description, Last notes) in CSV export when option "All columns" is selected NewMarius BĂLTEANU

Actions
Actions #1

Updated by Marius BĂLTEANU about 4 years ago

  • Assignee set to Marius BĂLTEANU
Actions #2

Updated by Go MAEDA about 4 years ago

  • Related to Feature #26081: Allow full_width_layout long-text custom fields to appear in the issue list like 'Description' (as a block column) added
Actions #4

Updated by Go MAEDA about 4 years ago

Thank you for posting the fix so quickly. But I think full-width columns should be exported even when "All columns" radio button is selected because they are columns.

Actions #5

Updated by Marius BĂLTEANU about 4 years ago

Go MAEDA wrote:

Thank you for posting the fix so quickly. But I think full-width columns should be exported even when "All columns" radio button is selected because they are columns.

Description is a column too and it's not exported when you select "All columns" because "All columns" refers to only inline columns.

Anyway, I think we can fix this for 4.1.1 and we can discuss for 4.2.0 to change the current behaviour to a simplified one where all columns includes all columns, regardless the type of the column and drop the checkboxes for block columns.

Actions #6

Updated by Go MAEDA about 4 years ago

I think the style of custom fields (inline / block) is just a UI matter, so it should not affect the exported data. The behavior is a bit confusing for me. Another problem is that users should click many checkboxes to get CSV data including all columns. It is a hassle for users if the project has many full-width custom fields.

However, if it is not easy to get back the behavior of Redmine 4.0, I think that having a button to check/uncheck all checkboxes can mitigate the second problem I mentioned above.

Marius, could you consider adding a check/uncheck button ( ) if you think the dialog should have checkboxes for full-width custom fields?

Actions #7

Updated by Marius BĂLTEANU about 4 years ago

Go MAEDA wrote:

I think the style of custom fields (inline / block) is just a UI matter, so it should not affect the exported data. The behavior is a bit confusing for me. Another problem is that users should click many checkboxes to get CSV data including all columns. It is a hassle for users if the project has many full-width custom fields.

However, if it is not easy to get back the behavior of Redmine 4.0, I think that having a button to check/uncheck all checkboxes can mitigate the second problem I mentioned above.

I'm confused. Are you sure that in Redmine 4.0, selecting "All Columns" without checking any block column, exports all the columns including "Description" and "Last notes"? Can you describe the old behaviour?

Actions #8

Updated by Go MAEDA about 4 years ago

Marius BALTEANU wrote:

I'm confused. Are you sure that in Redmine 4.0, selecting "All Columns" without checking any block column, exports all the columns including "Description" and "Last notes"? Can you describe the old behaviour?

In Redmine 4.0, selecting "All columns" does not export "Description" and "Last notes" but exports custom fields with full-width layout is enabled.

"The behavior of Redmine 4.0" I wrote in #33169#note-6 means that selecting "All columns" always exports custom fields with long text format, independent of the custom field's appearance (the value of "Full width layout" option).

Actions #9

Updated by Marius BĂLTEANU about 4 years ago

Go MAEDA wrote:

Marius BALTEANU wrote:

I'm confused. Are you sure that in Redmine 4.0, selecting "All Columns" without checking any block column, exports all the columns including "Description" and "Last notes"? Can you describe the old behaviour?

In Redmine 4.0, selecting "All columns" does not export "Description" and "Last notes" but exports custom fields with full-width layout is enabled.

"The behavior of Redmine 4.0" I wrote in #33169#note-6 means that selecting "All columns" always exports custom fields with long text format, independent of the custom field's appearance (the value of "Full width layout" option).

Yes, but it was this way because of an incomplete implementation of #21705 where the full width columns were considered inline columns. #26081 fixed that issue and generated this one. From my point of view, the existing behaviour is the following:
  • All or Selected columns refers only to inline columns
  • Each block column is shown as a checkbox.

I agree with you that is not the best solution and this is way I proposed to fix this as I proposed and to change totally the behaviour in 4.2.0 in order to have only All and Selected columns, regardless the type of the column (inline, block). I won't change this in a minor release.

Actions #10

Updated by Go MAEDA about 4 years ago

Marius BALTEANU wrote:

I agree with you that is not the best solution and this is way I proposed to fix this as I proposed and to change totally the behaviour in 4.2.0 in order to have only All and Selected columns, regardless the type of the column (inline, block). I won't change this in a minor release.

Thank you for the explanation.

I think the most important thing now is to add an ability to export full-width custom fields, putting my opinion aside. I think your patch is one of the good solutions for that and should be merged for 4.1.1.

However, I would like you to add a small feature. Could you consider to add a button to select/deselect all checkboxes? It is useful when issues have many full-width custom fields.

Imagine that each issue has 5 full-width custom fields. When a user wants to export all fields including full-width custom fields, the user should click "All columns", the checkbox for custom field 1, the checkbox for custom field 2, ... and the checkbox for custom field 5. It requires 6 clicks on the dialog before clicking "Export" button. Doing it every time you get a CSV is very tedious. The button to select/deselect all checkboxes can resolve the tediousness.

Actions #11

Updated by Marius BĂLTEANU about 4 years ago

Go MAEDA wrote:

Marius BALTEANU wrote:

I agree with you that is not the best solution and this is way I proposed to fix this as I proposed and to change totally the behaviour in 4.2.0 in order to have only All and Selected columns, regardless the type of the column (inline, block). I won't change this in a minor release.

Thank you for the explanation.

I think the most important thing now is to add an ability to export full-width custom fields, putting my opinion aside. I think your patch is one of the good solutions for that and should be merged for 4.1.1.

However, I would like you to add a small feature. Could you consider to add a button to select/deselect all checkboxes? It is useful when issues have many full-width custom fields.

Imagine that each issue has 5 full-width custom fields. When a user wants to export all fields including full-width custom fields, the user should click "All columns", the checkbox for custom field 1, the checkbox for custom field 2, ... and the checkbox for custom field 5. It requires 6 clicks on the dialog before clicking "Export" button. Doing it every time you get a CSV is very tedious. The button to select/deselect all checkboxes can resolve the tediousness.

I agree, feel free to add this on top of my patch.

Actions #12

Updated by Marius BĂLTEANU about 4 years ago

  • Assignee changed from Marius BĂLTEANU to Go MAEDA
Actions #13

Updated by Yuichi HARADA about 4 years ago

Marius, I understand very well what you want to say. However, many Redmine users do not think that "All columns" means only inline columns.
I suggest adding the following JavaScript to your patch( 0001-Fix-issues-and-spent-time-CSV-export-does-not-includ.patch ).
When you select "All Columns" and not checked any of the block columns, check all of the block columns. Probably, I think that many Redmine users can use it without discomfort.

diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb
index c4719569d..a0ad8b5e7 100644
--- a/app/views/issues/index.html.erb
+++ b/app/views/issues/index.html.erb
@@ -47,11 +47,21 @@
     <label><%= radio_button_tag 'c[]', '', true %> <%= l(:description_selected_columns) %></label><br />
     <label><%= radio_button_tag 'c[]', 'all_inline' %> <%= l(:description_all_columns) %></label>
   </p>
-  <p>
+  <p id="csv-export-block-columns">
     <% @query.available_block_columns.each do |column| %>
-      <label><%= check_box_tag 'c[]', column.name, @query.has_column?(column) %> <%= column.caption %></label>
+      <label><%= check_box_tag 'c[]', column.name, @query.has_column?(column), :id => nil %> <%= column.caption %></label>
     <% end %>
   </p>
+  <%= javascript_tag do %>
+  $(function(){
+    $('input[type="radio"][value="all_inline"]').click(function(){
+      var block_columns = $('#csv-export-block-columns input[type="checkbox"]');
+      if(block_columns.length && !block_columns.is(':checked')){
+        block_columns.prop('checked', true);
+      }
+    });
+  });
+  <% end %>
   <%= export_csv_encoding_select_tag %>
   <% if @issue_count > Setting.issues_export_limit.to_i %>
   <p class="icon icon-warning">
diff --git a/app/views/timelog/index.html.erb b/app/views/timelog/index.html.erb
index f60b51064..8ee8e4fe7 100644
--- a/app/views/timelog/index.html.erb
+++ b/app/views/timelog/index.html.erb
@@ -40,11 +40,21 @@
     <label><%= radio_button_tag 'c[]', '', true %> <%= l(:description_selected_columns) %></label><br />
     <label><%= radio_button_tag 'c[]', 'all_inline' %> <%= l(:description_all_columns) %></label>
   </p>
-  <p>
+  <p id="csv-export-block-columns">
     <% @query.available_block_columns.each do |column| %>
-      <label><%= check_box_tag 'c[]', column.name, @query.has_column?(:column) %> <%= column.caption %></label>
+      <label><%= check_box_tag 'c[]', column.name, @query.has_column?(:column), :id => nil %> <%= column.caption %></label>
     <% end %>
   </p>
+  <%= javascript_tag do %>
+  $(function(){
+    $('input[type="radio"][value="all_inline"]').click(function(){
+      var block_columns = $('#csv-export-block-columns input[type="checkbox"]');
+      if(block_columns.length && !block_columns.is(':checked')){
+        block_columns.prop('checked', true);
+      }
+    });
+  });
+  <% end %>
   <%= export_csv_encoding_select_tag %>
   <p class="buttons">
     <%= submit_tag l(:button_export), :name => nil, :onclick => "hideModal(this);", :data => { :disable_with => false } %>
Actions #14

Updated by Marius BĂLTEANU about 4 years ago

The patch contains too many lines of duplicated code and it doesn't work very well because the block columns are not unchecked after you select again "Selected columns" (to reproduce: check "All columns" and then check "Selected Columns"). Also, it changes the current behaviour where "Description" and "Last notes" are not selected when you check "All columns".

If we really want to fix this small issue in a minor version, let's do it by wrapping the checkboxes in a fieldset and have the existing green tick to handle the "Check/Uncheck all". Patch attached.

Actions #15

Updated by Go MAEDA about 4 years ago

  • Status changed from New to Closed
  • Resolution set to Fixed
Actions #16

Updated by Marius BĂLTEANU about 4 years ago

  • Related to Patch #33211: Include block columns (ex: Description, Last notes) in CSV export when option "All columns" is selected added
Actions

Also available in: Atom PDF