app/controllers/sales_controller.rb in artfully_ose-1.0.0.rc4 vs app/controllers/sales_controller.rb in artfully_ose-1.1.0.rc1

- old
+ new

@@ -6,11 +6,11 @@ redirect_to new_event_show_sales_path(@event, @show) end def new @person = Person.new - @sale = Sale.new(@show, @show.chart.sections) + @sale = Sale.new(@show, @show.chart.sections.box_office) @tickets_remaining = tickets_remaining setup_defaults end @@ -21,11 +21,11 @@ # Refactor this to maintain the cart across requests and clear the cart on successful sale # # In the meantime, BoxOffice::Cart has been jenked to just not lock tickets. # def create - @sale = Sale.new(@show, @show.chart.sections, params[:quantities]) + @sale = Sale.new(@show, @show.chart.sections.box_office, params[:quantities]) if checking_out? if @sale.sell(payment) @sale.message = "Sold #{self.class.helpers.pluralize(@sale.tickets.length, 'ticket')}. Order total was #{self.class.helpers.number_as_cents @sale.cart.total}" end end @@ -45,16 +45,22 @@ !params[:commit].blank? end def door_list_rows door_list_rows = [] + + puts @sale.tickets.inspect + @sale.tickets.each_with_index do |ticket, i| + ticket.reload if ticket.sold? || ticket.comped? door_list_rows[i] = {} - door_list_rows[i]['buyer'] = (@sale.buyer.first_name || "") + " " + (@sale.buyer.last_name || "") + door_list_rows[i]['first_name'] = @sale.buyer.first_name + door_list_rows[i]['last_name'] = @sale.buyer.last_name door_list_rows[i]['email'] = @sale.buyer.email door_list_rows[i]['section'] = ticket.section.name + door_list_rows[i]['payment_method'] = ticket.sold_item.order.payment_method door_list_rows[i]['price'] = ticket.sold_price end end door_list_rows end @@ -110,12 +116,9 @@ params[:credit_card][:number] = swiped_data.track1.primary_account_number params[:credit_card][:month] = swiped_data.track1.expiration_month params[:credit_card][:year] = swiped_data.track1.expiration_year end - puts " ***" - puts params[:credit_card][:number] - puts " ***" params[:benefactor] = current_user payment = Payment.create(params[:payment_method], params) payment.customer = person payment