OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/lib/open_project/costs/patches/permitted_params_patch.rb

41 lines
1.7 KiB

require_dependency 'permitted_params'
module OpenProject::Costs::Patches::PermittedParamsPatch
def self.included(base) # :nodoc:
base.send(:include, InstanceMethods)
end
module InstanceMethods
def cost_entry
params.require(:cost_entry).permit(:comments,
:units,
:overridden_costs,
:spent_on)
end
def cost_object
params.require(:cost_object).permit(:subject,
:description,
:fixed_date,
:project_manager_signoff,
:client_signoff,
{new_material_budget_item_attributes: [:units, :cost_type_id, :comments]},
{new_labor_budget_item_attributes: [:hours, :user_id, :comments]},
{existing_material_budget_item_attributes: [:units, :cost_type_id, :comments]},
{existing_labor_budget_item_attributes: [:hours, :user_id, :comments]})
end
def cost_type
params.require(:cost_type).permit(:name,
:unit,
:unit_plural,
:default,
{ new_rate_attributes: [:valid_from, :rate] },
{ existing_rate_attributes: [:valid_from, :rate] })
end
end
end
PermittedParams.send(:include, OpenProject::Costs::Patches::PermittedParamsPatch)