##// END OF EJS Templates
Merged r3668 from trunk....
Jean-Philippe Lang -
r3583:4a295e723e37
parent child
Show More
@@ -46,11 +46,13 class VersionsController < ApplicationController
46 46 end
47 47
48 48 def destroy
49 @version.destroy
50 redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project
51 rescue
52 flash[:error] = l(:notice_unable_delete_version)
53 redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project
49 if @version.fixed_issues.empty?
50 @version.destroy
51 redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project
52 else
53 flash[:error] = l(:notice_unable_delete_version)
54 redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project
55 end
54 56 end
55 57
56 58 def status_by
@@ -1,5 +1,5
1 # redMine - project management software
2 # Copyright (C) 2006 Jean-Philippe Lang
1 # Redmine - project management software
2 # Copyright (C) 2006-2010 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
@@ -16,10 +16,9
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class Version < ActiveRecord::Base
19 before_destroy :check_integrity
20 19 after_update :update_issues_from_sharing_change
21 20 belongs_to :project
22 has_many :fixed_issues, :class_name => 'Issue', :foreign_key => 'fixed_version_id'
21 has_many :fixed_issues, :class_name => 'Issue', :foreign_key => 'fixed_version_id', :dependent => :nullify
23 22 acts_as_customizable
24 23 acts_as_attachable :view_permission => :view_files,
25 24 :delete_permission => :manage_files
@@ -155,10 +154,7 class Version < ActiveRecord::Base
155 154 end
156 155 end
157 156
158 private
159 def check_integrity
160 raise "Can't delete version" if self.fixed_issues.find(:first)
161 end
157 private
162 158
163 159 # Update the issue's fixed versions. Used if a version's sharing changes.
164 160 def update_issues_from_sharing_change
General Comments 0
You need to be logged in to leave comments. Login now