From 1f2cbee0aab9938fcd5f91cdd4f1faae200fc8f4 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Fri, 23 Mar 2007 10:50:42 +0000 Subject: [PATCH] added issue validation on time_entry git-svn-id: http://redmine.rubyforge.org/svn/branches/work@366 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- time/app/models/time_entry.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/time/app/models/time_entry.rb b/time/app/models/time_entry.rb index a8c542a90..513652911 100644 --- a/time/app/models/time_entry.rb +++ b/time/app/models/time_entry.rb @@ -17,7 +17,7 @@ class TimeEntry < ActiveRecord::Base def validate errors.add :hours, :activerecord_error_invalid if hours && hours < 0 errors.add :project_id, :activerecord_error_invalid if project.nil? - errors.add :issue_id, :activerecord_error_invalid if issue && project!=issue.project + errors.add :issue_id, :activerecord_error_invalid if (issue_id && !issue) || (issue && project!=issue.project) end def spent_on=(date)