summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorMarius Balteanu <marius.balteanu@zitec.com>2022-06-16 21:28:22 +0000
committerMarius Balteanu <marius.balteanu@zitec.com>2022-06-16 21:28:22 +0000
commit83268a0636dac1dab23322a79ffd29f5cba2a81e (patch)
tree65636a7ff57f9dce5aff38addafbf7c32065d61c /app
parentf222d3d6b103a543d11db8052c63a032f584c529 (diff)
downloadredmine-83268a0636dac1dab23322a79ffd29f5cba2a81e.tar.gz
redmine-83268a0636dac1dab23322a79ffd29f5cba2a81e.zip
Merged r21637 and r21638 to 5.0-stable (#37171).
git-svn-id: https://svn.redmine.org/redmine/branches/5.0-stable@21639 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/models/issue.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 1ad09e0aa..84907a475 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -751,14 +751,20 @@ class Issue < ActiveRecord::Base
errors.add :start_date, :earlier_than_minimum_start_date, :date => format_date(soonest_start)
end
- if project && fixed_version
- if !assignable_versions.include?(fixed_version)
+ if project && fixed_version_id
+ if fixed_version.nil? || assignable_versions.exclude?(fixed_version)
errors.add :fixed_version_id, :inclusion
elsif reopening? && fixed_version.closed?
errors.add :base, I18n.t(:error_can_not_reopen_issue_on_closed_version)
end
end
+ if project && category_id
+ unless project.issue_category_ids.include?(category_id)
+ errors.add :category_id, :inclusion
+ end
+ end
+
# Checks that the issue can not be added/moved to a disabled tracker
if project && (tracker_id_changed? || project_id_changed?)
if tracker && !project.trackers.include?(tracker)