Adopt model to reference GroupOrder in generated FinancialTransaction

This commit is contained in:
Patrick Gansterer 2019-11-04 04:33:43 +01:00
parent b6542fb711
commit 17059a8104
7 changed files with 17 additions and 5 deletions

View file

@ -80,9 +80,9 @@ class Ordergroup < Group
# Creates a new FinancialTransaction for this Ordergroup and updates the account_balance accordingly.
# Throws an exception if it fails.
def add_financial_transaction!(amount, note, user, transaction_type, link = nil)
def add_financial_transaction!(amount, note, user, transaction_type, link = nil, group_order = nil)
transaction do
t = FinancialTransaction.new(ordergroup: self, amount: amount, note: note, user: user, financial_transaction_type: transaction_type, financial_link: link)
t = FinancialTransaction.new(ordergroup: self, amount: amount, note: note, user: user, financial_transaction_type: transaction_type, financial_link: link, group_order: group_order)
t.save!
update_balance!
# Notify only when order group had a positive balance before the last transaction: