Feature #1766

Custom fields should become addable to Spent Time list/report

Added by Mischa The Evil over 9 years ago. Updated about 2 years ago.

Status:ClosedStart date:2008-08-11
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Time tracking
Target version:2.3.0
Resolution:Fixed

Description

Like the subject states timelog.custom_field columns should become addable to the reports @ /projects/xxxprojectxxx/timelog/details.

They are available already as filters in the 'Spent Time'-report view.

a.png (28.5 KB) Felix M, 2015-07-15 18:00

b.png (29.7 KB) Felix M, 2015-07-15 18:00


Related issues

Related to Redmine - Feature #1692: Enable time-tracking additional fields in reports filters New 2008-07-28
Related to Redmine - Patch #3117: Add the possibility to select the comment field to /timel... New 2009-04-03
Related to Redmine - Patch #4705: Allow selection of up to five fields in timelog report New 2010-02-01
Related to Redmine - Feature #6972: Custom fields in timelog report Closed 2010-11-24
Related to Redmine - Feature #21061: Custom Field for Spent time New
Related to Redmine - Feature #25773: Add more custom fields types to criteria in time entries ... New
Duplicated by Redmine - Feature #6797: custom fields missing in time detail Closed 2010-11-02
Duplicated by Redmine - Feature #7634: Report on project custom field in time spent report Closed 2011-02-16

Associated revisions

Revision 10972
Added by Jean-Philippe Lang almost 5 years ago

Makes time entry custom fields available for display on the time entries list (#1766).

Revision 11174
Added by Jean-Philippe Lang almost 5 years ago

Makes issue custom fields available as timelog columns (#1766).

Revision 11459
Added by Jean-Philippe Lang almost 5 years ago

Makes project custom fields available on spent time report (#1766).

History

#1 Updated by Daniel Netzer over 9 years ago

This would greatly improve the usability of the timelog feature. I also noticed that only "boolean"-type custom fields appear as filter in the drop-down for Spent Time reports. Could you confirm this? Or do all your custom fileds are available?

#2 Updated by Daniel Netzer over 9 years ago

Duplicates #1692 - Jean-Philippe explained that currently only bolean and list types are available.

#3 Updated by Mischa The Evil over 9 years ago

I took the liberty to follow-up the discussion of this issue on the forums to keep the issue as concrete as possible... :-)

#4 Updated by Frédéric Moulins almost 8 years ago

The following patch allows to add comments to the list of fields : #3117.

To add up to 5 fields to the report : #4705.

Custom fields are already available, so the feature should be complete.

#5 Updated by Maciej Czub over 6 years ago

There are many gaps (mainly in the aspects of custom_fields) in the functionality of:
  • /projects/foo/timelog/details
  • /projects/foo/timelog/report
  • /time_entries
  • /time_entries/report

Key function is to display the custom fields in the detailed views and reports. It's now only partially implemented in the timelog CSV export feature. There are also requests for filtering by custom fields in details and grouping by custom fields in reports.

It would be nice if these gaps in functionality have been filled.

#6 Updated by Jamie Gruener over 6 years ago

Just to be clear, only some types of custom fields are available in the Report view. Specifically, text fields are not available, and I understand why, but that doesn't help folks who would like to see the data in Redmine (I stopped using Excel for a reason, folks!). Ideally, you could add additional fields to the Details view.

#7 Updated by Fabio Ginzel over 6 years ago

+1

#8 Updated by Jérôme BATAILLE over 6 years ago

+1

#9 Updated by Sergey Startsev over 5 years ago

Still waiting for the solution!
For example, the is no text field for a really full report and this is why I created a custom one. But to view this mostly meaningful for me information, I must go to the report editing page - anoing thing.

#10 Updated by Gabriel Pettier over 5 years ago

I did a patch to my redmine instance to allow Project custom fields (string and bool), it was done on an older version of redmine, i put it in the last git, but untested on this version.

https://github.com/tshirtman/redmine/commit/257b08e1359a19bc70cc555fdc7b8c6b8d842743

#11 Updated by Kelly Goedert over 5 years ago

+1

#12 Updated by Fernando Silveira over 5 years ago

+1

#13 Updated by Bo Hansen over 5 years ago

  • Assignee set to Jean-Philippe Lang

Could not get Gabriel's patch to work on 2.0.3, but here's one adding custom project fields of type list and bool to the time report view:

index 80e6052..28c2ed8 100644
--- a/lib/redmine/helpers/time_report.rb
+++ b/lib/redmine/helpers/time_report.rb
@@ -157,6 +157,13 @@ module Redmine
                                                  :label => cf.name}
         end

+        # add project custom fields
+        ProjectCustomField.find(:all).select {|cf| %w(list bool).include? cf.field_format }.each do |cf|
+          @available_criteria["cf_#{cf.id}"] = {:sql => "(SELECT c.value FROM #{CustomValue.table_name} c WHERE c.custom_field_id = #{cf.id} AND c.customized_type = 'Project' AND c.customized_id = #{TimeEntry.table_name}.project_id ORDER BY c.value)", 
+                                                 :format => cf.field_format,
+                                                 :label => cf.name}
+        end
+
         @available_criteria
       end
     end

This patch is actually well in line with issue #8161 adding project custom fields for issue queries. Could this patch go into the upcoming 2.1 release?

Best regards,
Bo

#14 Updated by Rami Sedhom about 5 years ago

+1

#15 Updated by Robert Barnebeck about 5 years ago

+1 It would be great to have the ability to show custom time entry fields in the Spent Time Details list!

#16 Updated by Jean-Philippe Lang about 5 years ago

  • Target version set to 2.3.0

#17 Updated by Bob Pack almost 5 years ago

Will this change also include Issue custom fields? This would make a great difference for my company.

If you need a use-case, consider this organization, which seems like it should be somewhat common and very powerful- we have issues/tasks that are organized according to component. The components (projects) are a flat list. We then get paid to make specific updates to different components, depending on the customers' needs/wants. So, a particular customer may want Components A,B, and C to get updated, with changes identified in Tasks X,Y,Z (members of A,B, and C respectively). That is a simple case, because of course there are many components, and many tasks, and many customers, but you should see where I'm going. It's very useful (and important) for me to be able to go to the Spent Time Report and identify what work was done for a particular customer on a particular contract. I can't do that today. ALSO, please note: I don't want my employees to enter the contract/client on their spent time report- I specifically want this data to be entered during the planning phase as a custom field on the issue, so upper management can have visibility to progress through the "All Issues" querying system. I have a different system to track time spent on contracts.

#18 Updated by Marc Neeley almost 5 years ago

+1 in what Bob Pack is saying here. I too see requests by external customers and internal managers wanting to see Estimated Time and % Complete shown next to Spent Time in the reports. This essentially becomes the Gantt in report form rather than graphic form. They are already seeing issues in the reports, just not various key fields.

#19 Updated by Jean-Philippe Lang almost 5 years ago

Bob Pack wrote:

Will this change also include Issue custom fields?

You will be able to filter the spent time list/report by issue custom fields.

#20 Updated by Jean-Philippe Lang almost 5 years ago

Issue custom fields are now available as columns in spent time details (r11174).

#21 Updated by Bo Hansen almost 5 years ago

Looks good in current trunk - much requested feature to get the filters in the report view.
Any chance to see the project custom fields added to the list of columns also?

Thanks in advance,
Bo

#22 Updated by Daniel Felix almost 5 years ago

Bo Hansen wrote:

Any chance to see the project custom fields added to the list of columns also?

This is also requested in another issue #1766.

#23 Updated by Bob Pack almost 5 years ago

Thanks for the work on this feature! It will be a huge help, and you can bet that as soon as 2.3 is released I will be upgrading. I may try out the trunk for the first time based on our need for this. This gives me another dimension to sort the data over, which I sorely have needed.

Marc Neeley wrote:

+1 in what Bob Pack is saying here. I too see requests by external customers and internal managers wanting to see Estimated Time and % Complete shown next to Spent Time in the reports. This essentially becomes the Gantt in report form rather than graphic form. They are already seeing issues in the reports, just not various key fields.

Marc - you are saying something slightly different from what I was saying. I was talking specifically about Custom Fields, and you are talking about built-in Issue fields. I can see some value in what you are saying, although I'm not sure it will work exactly as you want. Personally, I'd like to see an interface where I can look at the projected work for the month (factoring in "Estimated Time" on a month basis, similar to how it's done in Spent Time reports). Maybe that's what you want too? It won't work that way in the current structures, though, because Spent Time will only report on items that have had time spent on them (of course).

If that isn't your goal, maybe adding "Estimated Time" and "% Complete" in the "Overall Issues" filter view will give you some of you want.

#24 Updated by Bo Hansen almost 5 years ago

Updated patch for project custom fields in the criteria list for reports (merely an offset change, applies to 11447):

index 4798fe6..0615314 100644
--- a/lib/redmine/helpers/time_report.rb
+++ b/lib/redmine/helpers/time_report.rb
@@ -141,6 +141,13 @@ module Redmine
                                                  :label => cf.name}
         end

+        # add project custom fields
+        ProjectCustomField.find(:all).select {|cf| %w(list bool).include? cf.field_format }.each do |cf|
+          @available_criteria["cf_#{cf.id}"] = {:sql => "(SELECT c.value FROM #{CustomValue.table_name} c WHERE c.custom_field_id = #{cf.id} AND c.customized_type = 'Pr
+                                                 :format => cf.field_format,
+                                                 :label => cf.name}
+        end
+
         @available_criteria
       end
     end

Much appreciated if it makes it into 2.3.0.

/Bo

#25 Updated by Jean-Philippe Lang almost 5 years ago

  • Subject changed from Timelog custom-field columns should become addable to 'Spent Time'-details report. to Custom fields should become addable to Spent Time list/report
  • Status changed from New to Closed
  • Resolution set to Fixed

Bo Hansen wrote:

Updated patch for project custom fields in the criteria list for reports (merely an offset change, applies to 11447):
[...]

Much appreciated if it makes it into 2.3.0.

Project custom fields added to the spent time report in r11459.

#26 Updated by Bo Hansen almost 5 years ago

Thanks a lot, it's working nicely on trunk. Looking forward to next release :)

/Bo

#27 Updated by delfo esposito over 4 years ago

hi guys

is this true only for project's custom fields of type list?
i don't see my project custom fields of type TEXT in the options for time spent report

thanks

Delfo

#28 Updated by Sergey Startsev over 4 years ago

it's true for every type of fcustom field.
For example, we use TEXT field for additional comments to a reports.

#29 Updated by delfo esposito over 4 years ago

more details about my issue:
Report working:

/projects/cdgprojects/time_entries/report?utf8=%E2%9C%93&criteria[]=project&period_type=2&from=2013-06-01&to=2013-06-26&columns=month&criteria[]=cf_99

where cf_99 is type LIST

if i use cf_100 which is TEXT it is just ignored

anything in global settings to set maybe?

#30 Updated by Joel SCHAAL over 3 years ago

It seems I do not see our custom field (of type Integer) in the details of the time entries (when I access /projects/foo/issues/42/time_entries)
Did I miss something in my configuration (/ how I use this feature) or has there been a regression on this topic since 2.3.0 ?

#31 Updated by Felix M over 2 years ago

I agree with Joel: If this was working in 2.3.0, then there has been a regression.
I'm using 3.0.3.stable, and I'm trying to add an Issue's Custom Field of type text (called PSP) to the time report (time_entries/report).

It's possible to filter by my custom field:

But I can't add my custom field (of type text) to the report:

#32 Updated by Felix M over 2 years ago

I get the desired behavior (i.e. add a string custom field to the report) if I make the following changes:

in lib/redmine/field_format.rb, in class StringFormat add:
def group_statement(custom_field)
order_statement(custom_field)
end

in lib/redmine/helpers/time_report.rb
change custom_fields.select {|cf| %w(list bool string).include?(cf.field_format) && !cf.multiple?}.each do |cf|
to custom_fields.select {|cf| %w(list bool).include?(cf.field_format) && !cf.multiple?}.each do |cf|

But I don't understand why only list and bool had group_statement in field_format.rb and were treated differently in time_report.rb. Does my change have any unforseen consequences?

#33 Updated by Toshi MARUYAMA over 2 years ago

Felix M wrote:

I get the desired behavior (i.e. add a string custom field to the report) ...

I don't know it is related or not, I created issue #19121.

#34 Updated by James Vreeken about 2 years ago

I am also having this problem... we have a custom field called "Job Number" we would like to be able to create a report thru the tool that exports the week with time spent along with the job number... Its not working...

I tried what Felix M said to do by editing
lib/redmine/field_format.rb and lib/redmine/helpers/time_report.rb but I still can't get custom fields to show up in the list on the report tab...

#35 Updated by Toshi MARUYAMA about 2 years ago

#36 Updated by Mischa The Evil 6 months ago

  • Related to Feature #25773: Add more custom fields types to criteria in time entries report added

Also available in: Atom PDF