Add a parameter for financial_link to Ordergroup.add_financial_transaction
This commit is contained in:
parent
9f2e5bb992
commit
f209f4907e
1 changed files with 3 additions and 3 deletions
|
@ -55,9 +55,9 @@ class Ordergroup < Group
|
||||||
|
|
||||||
# Creates a new FinancialTransaction for this Ordergroup and updates the account_balance accordingly.
|
# Creates a new FinancialTransaction for this Ordergroup and updates the account_balance accordingly.
|
||||||
# Throws an exception if it fails.
|
# Throws an exception if it fails.
|
||||||
def add_financial_transaction!(amount, note, user)
|
def add_financial_transaction!(amount, note, user, link = nil)
|
||||||
transaction do
|
transaction do
|
||||||
t = FinancialTransaction.new(:ordergroup => self, :amount => amount, :note => note, :user => user)
|
t = FinancialTransaction.new(ordergroup: self, amount: amount, note: note, user: user, financial_link: link)
|
||||||
t.save!
|
t.save!
|
||||||
self.account_balance = financial_transactions.sum('amount')
|
self.account_balance = financial_transactions.sum('amount')
|
||||||
save!
|
save!
|
||||||
|
|
Loading…
Reference in a new issue