Project

General

Profile

Patch #4850 ยป extract_updatable_attrs_on_move.patch

Holger Just, 2010-02-15 18:10

View differences:

app/controllers/issues_controller.rb (working copy)
315 315
    @target_project ||= @project    
316 316
    @trackers = @target_project.trackers
317 317
    @available_statuses = Workflow.available_statuses(@project)
318
    call_hook(:controller_issues_edit_before_change, { :params => params, :issue => @issue, :target_project => @target_project})
318 319
    if request.post?
319 320
      new_tracker = params[:new_tracker_id].blank? ? nil : @target_project.trackers.find_by_id(params[:new_tracker_id])
320 321
      unsaved_issue_ids = []
321 322
      moved_issues = []
322 323
      @issues.each do |issue|
323 324
        changed_attributes = {}
324
        [:assigned_to_id, :status_id, :start_date, :due_date].each do |valid_attribute|
325
        self.updatable_attrs_on_move.each do |valid_attribute|
325 326
          unless params[valid_attribute].blank?
326 327
            changed_attributes[valid_attribute] = (params[valid_attribute] == 'none' ? nil : params[valid_attribute])
327 328
          end 
......
571 572
    sort_clear
572 573
    render_error "An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator."
573 574
  end
575
  
576
  # Attributes that can be updated on issue move
577
  def updatable_attrs_on_move
578
    [:assigned_to_id, :status_id, :start_date, :due_date]
579
  end
574 580
end
app/views/issues/move.rhtml (working copy)
42 42
  <label><%= l(:field_due_date) %></label>
43 43
  <%= text_field_tag 'due_date', '', :size => 10 %><%= calendar_for('due_date') %>
44 44
</p>
45

  
46
<%= call_hook(:view_issues_move_bottom, :issue => @issue) %>
47

  
45 48
</div>
46 49

  
47 50
<% if @copy %>
    (1-1/1)