Adding Column to Time Log Table

Added by Marek Stepan 6 days ago

Hello ,
so i was tasked with adding the Project description column to the Time Log Table in Redmine 4.0.2 , i have no idea where to start and my searched attempts brought no fruit .

I know of custom columns but there doesnt seem to be a option to merge a custom column with the data of a existing table /description/ .

Any pointers on how to accomplish this are greatly apreaciated .

Yours Friendly ,
Marek Stepan

Replies (5)

RE: Adding Column to Time Log Table - Added by Bernhard Rohloff 6 days ago

Hi Marek,

look at source:trunk/app/models/time_entry_query.rb#L25.
I think adding the following line should do the trick., :sortable => "#{Project.table_name}.description", :groupable => false),

Kind regards,


RE: Adding Column to Time Log Table - Added by Marek Stepan 4 days ago

Hello Bernhard ,
Firstmost ,i thank you for your reply and help.

I did as you told , and added the line in the correct file in opt/bitnami/apps/redmine/htdocs/app/models/time_entry_query.rb

Restart all services with ./ restart in opt/bitnami .

But unfortunately it didnt seem to do the trick .
Am i missing something ? Im sorry upfront if im missing something "newbie-like" but im completly new to redmine .

//EDIT: I then realized maybe i need to add it in the administrator section after these changes , when i saw two Project columns i was hopefull that that was it but , i could not add both of them to the "Selected columns " list , then i tried changing the codeline , which changed the name of the Object in the list and i was able to add it to "selected columns" but then redmine Timelog window crashed . (After each stepp i run restart )

", :sortable => "#{Project.table_name}.description", :groupable => false),"

Any Suggestions or help is apreciated .

Yours Friendly ,
Marek Stepan

code change.PNG - initial code change (438 KB)

project columns.PNG - two project columns (8.33 KB)

description columnt.PNG - after changing project to description (17.5 KB)

error.PNG - crashing on time log view (9.68 KB)

RE: Adding Column to Time Log Table - Added by Bernhard Rohloff 4 days ago

Oh yes you're right!
It seems I was a bit too confident with my answer and haven't tested it beforehand. Sorry for that.
This line actually works in my dev-environment:, :description, :caption => :field_description, :sortable => "#{Project.table_name}.description"),

I haven't found a label for "project description" so for testing I have chosen the :field_description label.
As "Description" is a kind of vague name for that column I would recommend that you create a separate label for it.
But if you don't care about it this is all you have to change.



RE: Adding Column to Time Log Table - Added by Marek Stepan 3 days ago

For Some Reason i cant send the reply i written to you and get an Error Message .

//EDIT Message:

Thank you !
This worked like a charm ,

Intrigued by the usage of Querycolumn and QueryAssociationColumn to self educate i dove into the docs of but i found only method and object specification not
really any deeper or practical explanation and i could wrap my hand around the usage/difference between them . Do you maybe at any chance know of better learning material for Ruby/Redmine development ?

In hopes it is not too much to ask more of your time and knowledge , do you have any pointers for me on the label creation/implementation part you spoke about ?
Altought the change you suggested is enought for meeting the needs , i would like to make the proper changes .

Lastly Thank you again for sharing with me your time and knowledge ,

I completly understand if you dont have the time ,
or dont have the information at hand , which i asked for .

redmine errro.PNG (12.4 KB)

RE: Adding Column to Time Log Table - Added by Bernhard Rohloff 3 days ago

I'm glad to hear it works for you. Unfortunately there are no real sources of system documentation for Redmine. Sometimes it's quite hard to find the right parts to change. Most of my knowledge I've gathered from the code itself and from patches on the issue tracker. Studying the patches is a very good method because you get a feeling for what is actually needed to change things. Just like a small how-to guide. Of course a ruby or rails course is a good way to build fundamentals.
For plugin development I can recommend the book "Redmine Plugin Extension and Develoment" by Alex Bevilacqua and there is also a tutorial on how to write plugins in the wiki.

So for getting into Redmine the best thing you can do is setting up a development environment and start playing with it.
Don't be afraid to ask if you have any further questions. :-)