summaryrefslogtreecommitdiffstats
path: root/app/models/time_entry.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-05-30 08:46:41 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-05-30 08:46:41 +0000
commit62bed8b93f1bdfdc8ee52db00133bfe0880d4842 (patch)
tree997b7ecf37e67438ff80fb1031fc6a25d2439d33 /app/models/time_entry.rb
parent216a153421b05bce4d4e64b590889b740367b92e (diff)
downloadredmine-62bed8b93f1bdfdc8ee52db00133bfe0880d4842.tar.gz
redmine-62bed8b93f1bdfdc8ee52db00133bfe0880d4842.zip
Validates that activity belongs to project activities (#19656).
git-svn-id: http://svn.redmine.org/redmine/trunk@14288 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/time_entry.rb')
-rw-r--r--app/models/time_entry.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/app/models/time_entry.rb b/app/models/time_entry.rb
index c5a917d96..062e9c80b 100644
--- a/app/models/time_entry.rb
+++ b/app/models/time_entry.rb
@@ -116,6 +116,7 @@ class TimeEntry < ActiveRecord::Base
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 :activity_id, :inclusion if activity_id_changed? && project && !project.activities.include?(activity)
end
def hours=(h)