Fixed order.close workflow. (formerly known as order.balance)

This commit is contained in:
Benjamin Meichsner 2009-01-30 22:27:55 +01:00
parent 288566f000
commit ec402ffa7b
4 changed files with 22 additions and 21 deletions

View file

@ -1,10 +1,10 @@
class Finance::BalancingController < ApplicationController
before_filter :authenticate_finance
verify :method => :post, :only => [:close_direct]
verify :method => :post, :only => [:close, :close_direct]
def index
@financial_transactions = FinancialTransaction.find(:all, :order => "created_on DESC", :limit => 8)
@orders = Order.finished
@orders = Order.finished_not_closed
@unpaid_invoices = Invoice.unpaid
end
@ -200,12 +200,12 @@ class Finance::BalancingController < ApplicationController
def close
@order = Order.find(params[:id])
begin
@order.balance(@current_user)
@order.close!(@current_user)
flash[:notice] = "Bestellung wurde erfolgreich abgerechnet, die Kontostände aktualisiert."
redirect_to :action => "index"
rescue => e
flash[:error] = "Ein Fehler ist beim Abrechnen aufgetreten: " + e
redirect_to :action =>"editOrder", :id => @order
redirect_to :action => "new", :id => @order
end
end