Add default spent time activity per role
Currently, you can set a default spent time activity for all users, regardless their role.
I find it more useful if we add a default activity for each role (and not for each user how is requested in #938) because an user can have different roles per projects. Maybe in one project I'm a developer and I want to have the "Development" activity as default, and in another project I've the "Manager" role and I want to have the "Project Management" activity as default.
If a role doesn't have a default activity, the global should be set as default if exists, otherwise blank.
Any feedback is welcome.
Updated by Marius BALTEANU over 5 years ago
- File 0001-Option-to-set-default-time-entry-activity-per-role.patch 0001-Option-to-set-default-time-entry-activity-per-role.patch added
- File default_role_time_entry.png default_role_time_entry.png added
- Assignee deleted (
Attached is the patch that adds the option to define a default time entry activity for each role.
Any feedback is welcome.
Updated by Gerardo Schild about 5 years ago
I am using redmine 3.4.6 on bitnami, although the patch did not work, I applied the changes manually and I had the following error, which should be corrected for the patch
I get the error of: undefined function punk which solves it with .sort.map(&:default_time_entry_activity_id)
Updated by Mizuki ISHIKAWA over 1 year ago
- File 0001-Option-to-set-default-time-entry-activity-per-role-r21737.patch 0001-Option-to-set-default-time-entry-activity-per-role-r21737.patch added
I think this feature very useful.
I have made changes so that I can apply the patch to the latest code.
- Delete TimeEntryActivity.allowed_activities and replace with existing TimeEntryActivity.available_activities
- Integrate the code for selecting the existing default activity( https://github.com/redmine/redmine/blob/04e5ae033bf78d7cfd55dd1b905df79c2a913f83/app/models/time_entry.rb#L110-L114 ) into TimeEntryActivity.default_activity_id
- Add test for TimeEntryActivity.default_activity_id
- The change in https://github.com/redmine/redmine/commit/2fdbcd35dd8cc2f6b98340825a57afd24ff89670#diff-d94d27c8c3a5137bab78b034894d9feba4abaac9144c3177daaa4bc1eba6f02aR95 no longer sets the initial user, so the role for selecting the default activity is now taken from User.current (in the patch, it was self.user, so it was no longer working).
- Member.find_or_new method is gone, replaced with Member.find_or_initialize_by.