app/controllers/report_controller/reports.rb
# Check if chargeback field is valid
Check if chargeback field is valid
Check if chargeback field is valid
def valid_chargeback_fields
    is_valid = false
    if %w(owner tenant tag).include?(@edit[:new][:cb_show_typ])
      is_valid = case @edit[:new][:cb_show_typ]
                 when "owner" then @edit[:new][:cb_owner_id]
                 when "tenant" then @edit[:new][:cb_tenant_id]
                 when "tag" then @edit[:new][:cb_tag_cat] && @edit[:new][:cb_tag_value]
                 end
    end
    is_valid
  end
def valid_chargeback_fields is_valid = false if %w( owner tenant tag ) . include? ( @edit [ :new ] [ :cb_show_typ ] ) is_valid = case @edit [ :new ] [ :cb_show_typ ] when "owner" then @edit [ :new ] [ :cb_owner_id ] when "tenant" then @edit [ :new ] [ :cb_tenant_id ] when "tag" then @edit [ :new ] [ :cb_tag_cat ] && @edit [ :new ] [ :cb_tag_value ] end end is_valid end
Check if chargeback field is valid
Check if chargeback field is valid
# There are valid show typ fields