Sha256: 5b922607dd89fdfb26441868ea17e77c576696e581422910a856720908c25890

Contents?: true

Size: 1.2 KB

Versions: 6

Compression:

Stored size: 1.2 KB

Contents

module Spree
  module Admin
    module Orders
      class CustomerDetailsController < Spree::Admin::BaseController
        before_filter :load_order

        def show
          edit
          render :action => :edit
        end

        def edit
          country_id = Address.default.country.id
          @order.build_bill_address(:country_id => country_id) if @order.bill_address.nil?
          @order.build_ship_address(:country_id => country_id) if @order.ship_address.nil?
        end

        def update
          if @order.update_attributes(params[:order])
            if params[:guest_checkout] == "false"
              @order.associate_user!(Spree.user_class.find_by_email(@order.email))
            end
            while @order.next; end

            @order.refresh_shipment_rates
            flash[:success] = Spree.t('customer_details_updated')
            redirect_to admin_order_customer_path(@order)
          else
            render :action => :edit
          end

        end

        private

          def load_order
            @order = Order.find_by_number!(params[:order_id], :include => :adjustments)
          end

          def model_class
            Spree::Order
          end

      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spree_backend-2.0.13 app/controllers/spree/admin/orders/customer_details_controller.rb
spree_backend-2.0.12 app/controllers/spree/admin/orders/customer_details_controller.rb
spree_backend-2.0.11 app/controllers/spree/admin/orders/customer_details_controller.rb
spree_backend-2.0.10 app/controllers/spree/admin/orders/customer_details_controller.rb
spree_backend-2.0.9 app/controllers/spree/admin/orders/customer_details_controller.rb
spree_backend-2.0.8 app/controllers/spree/admin/orders/customer_details_controller.rb