Registrations should work w/o supporter levels

This commit is contained in:
Matt Barringer 2013-02-06 18:12:13 +01:00
parent d6bda2f6dc
commit c3c8c2df34

View file

@ -42,14 +42,16 @@ class ConferenceRegistrationController < ApplicationController
supporter_reg = params[:registration][:supporter_registration_attributes] supporter_reg = params[:registration][:supporter_registration_attributes]
params[:registration].delete :supporter_registration_attributes params[:registration].delete :supporter_registration_attributes
registration = person.registrations.new(params[:registration]) registration = person.registrations.new(params[:registration])
if !supporter_reg[:id].blank? if conference.use_supporter_levels? && !supporter_reg.nil?
# This means that their supporter registration was entered ahead of time, probably by an admin if !supporter_reg[:id].blank?
registration.supporter_registration = SupporterRegistration.find(supporter_reg[:id]) # This means that their supporter registration was entered ahead of time, probably by an admin
if registration.supporter_registration.email != person.email registration.supporter_registration = SupporterRegistration.find(supporter_reg[:id])
raise "Invalid code" if registration.supporter_registration.email != person.email
raise "Invalid code"
end
else
registration.supporter_registration = conference.supporter_registrations.new(supporter_reg)
end end
else
registration.supporter_registration = conference.supporter_registrations.new(supporter_reg)
end end
registration.conference_id = conference.id registration.conference_id = conference.id