Add a parameter for financial_link to Ordergroup.add_financial_transaction

This commit is contained in:
Patrick Gansterer 2017-10-28 20:54:08 +02:00
parent 9f2e5bb992
commit f209f4907e

View file

@ -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!