Removed superfluous method and statement

pull/294/head
Hagen Schink 11 years ago
parent 8c758ae7fa
commit b684eb5f0a
  1. 5
      app/controllers/work_packages/moves_controller.rb
  2. 39
      app/controllers/work_packages_controller.rb

@ -23,7 +23,6 @@ class WorkPackages::MovesController < ApplicationController
def create
prepare_for_work_package_move
if request.post?
new_type = params[:new_type_id].blank? ? nil : @target_project.types.find_by_id(params[:new_type_id])
unsaved_work_package_ids = []
moved_work_packages = []
@ -50,7 +49,6 @@ class WorkPackages::MovesController < ApplicationController
end
return
end
end
def set_flash_from_bulk_work_package_save(work_packages, unsaved_work_package_ids)
if unsaved_work_package_ids.empty? and not work_packages.empty?
@ -71,7 +69,8 @@ class WorkPackages::MovesController < ApplicationController
# Filter for bulk work package operations
def find_work_packages
@work_packages = WorkPackage.find_all_by_id(params[:work_package_id] || params[:ids])
@work_packages = WorkPackage.includes(:project)
.find_all_by_id(params[:work_package_id] || params[:ids])
raise ActiveRecord::RecordNotFound if @work_packages.empty?
@projects = @work_packages.collect(&:project).compact.uniq
@project = @projects.first if @projects.size == 1

@ -41,7 +41,6 @@ class WorkPackagesController < ApplicationController
before_filter :authorize,
:assign_planning_elements
before_filter :apply_at_timestamp, :only => [:show]
before_filter :build_new_work_package_from_params, :only => [:new]
helper :timelines
helper :timelines_journals
@ -309,42 +308,4 @@ class WorkPackagesController < ApplicationController
render_errors(:at => 'unknown format')
end
private
def build_new_work_package_from_params
if params[:id].blank?
@work_package = WorkPackage.new
@work_package.copy_from(params[:copy_from]) if params[:copy_from]
else
@work_package = @project.work_packages.visible.find(params[:id])
end
@work_package.project = @project
# Type must be set before custom field values
@work_package.type ||= @project.types.find((params[:issue] && params[:issue][:type_id]) || params[:type_id] || :first)
#if @work_package.type.nil?
# render_error l(:error_no_type_in_project)
# return false
#end
@work_package.start_date ||= User.current.today if Setting.issue_startdate_is_adddate?
if params[:issue].is_a?(Hash)
@work_package.safe_attributes = params[:issue]
@work_package.priority_id = params[:issue][:priority_id] unless params[:issue][:priority_id].nil?
if User.current.allowed_to?(:add_work_package_watchers, @project) && @issue.new_record?
@work_package.watcher_user_ids = params[:issue]['watcher_user_ids']
end
end
# Copy watchers if we're copying a work package
if params[:copy_from] && User.current.allowed_to?(:add_work_package_watchers, @project)
@work_package.watcher_user_ids = WorkPackage.visible.find(params[:copy_from]).watcher_user_ids
end
@work_package.author = User.current
@priorities = IssuePriority.all
@allowed_statuses = @work_package.new_statuses_allowed_to(User.current, true)
end
end

Loading…
Cancel
Save