Initial commit of foodsoft 2
This commit is contained in:
commit
5b9a7e05df
657 changed files with 70444 additions and 0 deletions
21
app/models/financial_transaction.rb
Normal file
21
app/models/financial_transaction.rb
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# financial transactions are the foodcoop internal financial transactions
|
||||
# only order_groups have an account balance and are happy to transfer money
|
||||
#
|
||||
# financial transaction have the following attributes:
|
||||
# * order_group_id (int)
|
||||
# * amount (decimal)
|
||||
# * note (text)
|
||||
# * created_on (datetime)
|
||||
class FinancialTransaction < ActiveRecord::Base
|
||||
belongs_to :order_group
|
||||
belongs_to :user
|
||||
|
||||
validates_presence_of :note, :user_id, :order_group_id
|
||||
validates_numericality_of :amount
|
||||
|
||||
# Custom attribute setter that accepts decimal numbers using localized decimal separator.
|
||||
def amount=(amount)
|
||||
self[:amount] = FoodSoft::delocalizeDecimalString(amount)
|
||||
end
|
||||
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue