From 9f6277e07c94e17f797a257079517af7220f97f1 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Tue, 11 Dec 2018 03:55:58 +0000 Subject: 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 --- app/models/time_entry.rb | 3 +++ app/views/settings/_timelog.html.erb | 2 ++ 2 files changed, 5 insertions(+) (limited to 'app') 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 @@

<%= setting_text_field :timelog_max_hours_per_day, :size => 6 %>

<%= setting_check_box :timelog_accept_0_hours %>

+ +

<%= setting_check_box :timelog_accept_future_dates %>

-- cgit v1.2.3