Project

General

Profile

Create gui for hardcoded setting

Added by Pavel Potcheptsov almost 9 years ago

===================================================================
--- app/models/time_entry.rb    (revision 14266)
+++ app/models/time_entry.rb    (working copy)
@@ -90,6 +91,7 @@
     errors.add :hours, :invalid if hours && (hours < 0 || hours >= 1000)
     errors.add :project_id, :invalid if project.nil?
     errors.add :issue_id, :invalid if (issue_id && !issue) || (issue && project!=issue.project) || @invalid_issue_id
+    errors.add :spent_on,  "is too early" if (spent_on < Date.today - 7.day) && ([1,10,100].exclude? User.current.id)
   end

What this line is actually does?
It sets number of days in the past you're allowed to log spent time for.
If you try to log spent time for date in the past that is older then 7 days from current date then error is appears.
In same time you could set users' ids who is excluded from date checking.

I'd like to have this setting in top menu (or in redmine's settings or as a plugin).
Settings must have:
- radio button or check box to enable/disable this feature
- configurable amount of days (drop down list or field for entering digits)
- ability to select users who excluded from checking
- save button
- this settings must be available for Admin users only
- this setting must be applied without restarting redmine

In case of success I'd like to contribute this feature as a patch to core redmine, thus plugin is not an option here.

Please see my email in profile.

Contact language: English, Russian.

Paid: fixed price.


    (1-1/1)