diff options
author | Go MAEDA <maeda@farend.jp> | 2018-12-11 03:55:58 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2018-12-11 03:55:58 +0000 |
commit | 9f6277e07c94e17f797a257079517af7220f97f1 (patch) | |
tree | 81c3e3cf016c3debd6a482a8b424450b593cce38 /app | |
parent | 27b6e595f7ca6b3e66cb43c2683a4fcdb5927690 (diff) | |
download | redmine-9f6277e07c94e17f797a257079517af7220f97f1.tar.gz redmine-9f6277e07c94e17f797a257079517af7220f97f1.zip |
Setting to restrict spent times on future dates (#3322).
Patch by Marius BALTEANU.
git-svn-id: http://svn.redmine.org/redmine/trunk@17719 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/models/time_entry.rb | 3 | ||||
-rw-r--r-- | app/views/settings/_timelog.html.erb | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/app/models/time_entry.rb b/app/models/time_entry.rb index d64c311fa..095653266 100644 --- a/app/models/time_entry.rb +++ b/app/models/time_entry.rb @@ -136,6 +136,9 @@ class TimeEntry < ActiveRecord::Base 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 :activity_id, :inclusion if activity_id_changed? && project && !project.activities.include?(activity) + if spent_on_changed? && user + errors.add :base, I18n.t(:error_spent_on_future_date) if (!Setting.timelog_accept_future_dates? && (spent_on > user.today)) + end end def hours=(h) diff --git a/app/views/settings/_timelog.html.erb b/app/views/settings/_timelog.html.erb index bc5f054c2..01d42384b 100644 --- a/app/views/settings/_timelog.html.erb +++ b/app/views/settings/_timelog.html.erb @@ -7,6 +7,8 @@ <p><%= setting_text_field :timelog_max_hours_per_day, :size => 6 %></p> <p><%= setting_check_box :timelog_accept_0_hours %></p> + +<p><%= setting_check_box :timelog_accept_future_dates %></p> </div> <fieldset class="box"> |