|
|
|
@ -125,7 +125,7 @@ class VariableCostObject < CostObject |
|
|
|
|
labor_budget_item_attributes.each do |index, attributes| |
|
|
|
|
if attributes[:hours].to_i > 0 && |
|
|
|
|
attributes[:user_id].to_i > 0 && |
|
|
|
|
project.assignable_users.map(&:id).include?(attributes[:user_id].to_i) |
|
|
|
|
project.possible_assignees.map(&:id).include?(attributes[:user_id].to_i) |
|
|
|
|
|
|
|
|
|
item = labor_budget_items.build(attributes) |
|
|
|
|
item.cost_object = self # to please the labor_budget_item validation |
|
|
|
@ -137,7 +137,7 @@ class VariableCostObject < CostObject |
|
|
|
|
labor_budget_items.reject(&:new_record?).each do |labor_budget_item| |
|
|
|
|
attributes = labor_budget_item_attributes[labor_budget_item.id.to_s] |
|
|
|
|
if User.current.allowed_to? :edit_cost_objects, labor_budget_item.cost_object.project |
|
|
|
|
if attributes && attributes[:hours].to_i > 0 && attributes[:user_id].to_i > 0 && project.assignable_users.map(&:id).include?(attributes[:user_id].to_i) |
|
|
|
|
if attributes && attributes[:hours].to_i > 0 && attributes[:user_id].to_i > 0 && project.possible_assignees.map(&:id).include?(attributes[:user_id].to_i) |
|
|
|
|
attributes[:budget] = Rate.clean_currency(attributes[:budget]) |
|
|
|
|
labor_budget_item.attributes = attributes |
|
|
|
|
else |
|
|
|
|