Method: BudgetPeriodObject#edit

Defined in:
lib/kuality-coeus/data_objects/budget/budget_periods.rb

#edit(opts = {}) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/kuality-coeus/data_objects/budget/budget_periods.rb', line 40

def edit opts={}
  navigate
  on Parameters do |edit|
    edit.start_date_period(@number).fit opts[:start_date]
    edit.end_date_period(@number).fit opts[:end_date]
    # TODO: At some point it may become critical for the data object to automatically "know" that the total sponsor cost
    # is always the sum of the direct and f&a costs.
    dollar_fields.each do |field|
      edit.send("#{field}_period", @number).fit opts[field]
    end
    edit.save
    break if edit.errors.size > 0
  end
  set_options(opts)
  datify
  add_cost_sharing opts[:cost_sharing]
end