summaryrefslogtreecommitdiffstats
path: root/app/models/issue.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2010-02-23 21:26:29 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2010-02-23 21:26:29 +0000
commite24d6cc2237d4898e7ad2520e34328f8dc0d5935 (patch)
treedf976b4cac350b67aa4adf0dd00c7ebce1e6a130 /app/models/issue.rb
parent01dbba72ab273b0ed9b77e3b9f6c318f626009c4 (diff)
downloadredmine-e24d6cc2237d4898e7ad2520e34328f8dc0d5935.tar.gz
redmine-e24d6cc2237d4898e7ad2520e34328f8dc0d5935.zip
Bulk edit refactoring.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3478 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/issue.rb')
-rw-r--r--app/models/issue.rb26
1 files changed, 7 insertions, 19 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 8a1413600..63602dd21 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -136,24 +136,6 @@ class Issue < ActiveRecord::Base
end
return issue
end
-
- def bulk_edit(params)
- journal = init_journal(User.current, params[:notes])
- self.tracker = params[:tracker] if params[:tracker]
- self.priority = params[:priority] if params[:priority]
- self.assigned_to = params[:assigned_to] if params[:assigned_to] || params[:assigned_to_id] == 'none'
- self.category = params[:category] if params[:category] || params[:category_id] == 'none'
- self.fixed_version = params[:fixed_version] if params[:fixed_version] || params[:fixed_version_id] == 'none'
- self.start_date = params[:start_date] unless params[:start_date].blank?
- self.due_date = params[:due_date] unless params[:due_date].blank?
- self.done_ratio = params[:done_ratio] unless params[:done_ratio].blank?
- self.custom_field_values = params[:custom_field_values] if params[:custom_field_values] && !params[:custom_field_values].empty?
- # TODO: Edit hook name
- Redmine::Hook.call_hook(:controller_issues_bulk_edit_before_save, { :params => params, :issue => self })
-
- # Don't save any change to the issue if the user is not authorized to apply the requested status
- return (params[:status].nil? || (new_statuses_allowed_to(User.current).include?(params[:status]) && self.status = params[:status])) && save
- end
def priority_id=(pid)
self.priority = nil
@@ -206,7 +188,13 @@ class Issue < ActiveRecord::Base
# TODO: move workflow/permission checks from controllers to here
def safe_attributes=(attrs, user=User.current)
return if attrs.nil?
- self.attributes = attrs.reject {|k,v| !SAFE_ATTRIBUTES.include?(k)}
+ attrs = attrs.reject {|k,v| !SAFE_ATTRIBUTES.include?(k)}
+ if attrs['status_id']
+ unless new_statuses_allowed_to(user).collect(&:id).include?(attrs['status_id'].to_i)
+ attrs.delete('status_id')
+ end
+ end
+ self.attributes = attrs
end
def done_ratio